I have an Ubuntu larval AWS instance running and I am trying to change some permissions:
When I visit my IP address for my newly installed site I get this warning:
The /var/www/seekadventure.net directory is not writable.
Please chmod this directory and its contents to 0775.
So in the command line I try this:
ubuntu@ip-172-31-80-211:/var/www$ sudo chmod 0775 /var/www/seekadventure.net
ubuntu@ip-172-31-80-211:/var/www$ ls -la
total 20
drwxr-xr-x 5 root root 4096 Dec 14 05:32 .
drwxr-xr-x 14 root root 4096 Feb 27 2018 ..
drwxr-xr-x 12 www-data www-data 4096 Feb 28 2018 laravel5.6
drwxrwxr-x 5 root root 4096 Dec 14 05:34 seekadventure.net
drwxr-xr-x 3 www-data www-data 4096 Nov 8 13:32 utility
ubuntu@ip-172-31-80-211:/var/www$
And as you can see from the ls -la
command its still root root
Any ideas why the permissions are not changing?
Update:
While doing further investigation I saw the mount command could show more useful information:
ubuntu@ip-172-31-80-211:/var/www$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=2014540k,nr_inodes=503635,mo de=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmod e=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=404508k,mode=755)
/dev/xvda1 on / type ext4 (rw,relatime,discard,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relat ime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xa ttr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpu set)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hu getlb)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatim e,cpu,cpuacct)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime ,perf_event)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,mem ory)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,fr eezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,re latime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,de vices)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blki o)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=31,pgrp=1,time out=0,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
lxcfs on /var/lib/lxcfs type fuse.lxcfs (rw,nosuid,nodev,relatime,user_id=0,grou p_id=0,allow_other)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=404508k,mode=7 00,uid=1000,gid=1000)
ubuntu@ip-172-31-80-211:/var/www$
Your answer You got this error because your user is not the owner of /root folder. So you can't change the permission of your folder other than the root user. You need to switch to your root account and run the commands as shown below.
Use the dynamic linker/loader to run chmod Another clever trick is to run chmod (yes, even without it having execute permission) by supplying it as an argument to the dynamic linker/loader. This is similar to running a script that doesn't have execute permission set by supplying it as an argument to bash.
To change directory permissions in Linux, use the following commands: chmod +rwx filename to add permissions; chmod -rwx directoryname to remove permissions; chmod +x filename to allow executable permissions; and chmod -wx filename to take out write and executable permissions.
sudo chmod 775 . You can just do sudo chmod 775 /opt without cd . Bye the way, -R option of chmod is recursively mode changing. man chmod for more information.
Use chmod
command to change file access permission such as read(r)
, write(w)
and execute(x)
.
Use chown
command to change file owner and group information.
if you want to change file access permission then try it :
sudo chmod 777 /var/www/seekadventure.net
4 stands for read
.
2 stands for write
.
1 stands for execute
.
0 stands for no permission
.
sudo chmod -R 0775 /var/www/seekadventure.net
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With