Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

chmod 0775 is not changing permissions

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$
like image 875
Ten Digit Grid Avatar asked Dec 14 '18 06:12

Ten Digit Grid


People also ask

Why is chmod not changing permissions?

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.

What to do if chmod is not working?

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.

How do I force change permissions in Linux?

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.

How do I give permission to 775 in Linux?

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.


2 Answers

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.

like image 168
Papan Avatar answered Sep 21 '22 19:09

Papan


sudo chmod -R 0775 /var/www/seekadventure.net
like image 39
sachin_ur Avatar answered Sep 23 '22 19:09

sachin_ur