Sample Header Ad - 728x90

Changing file permissions from 777 to 755 or changing the owner doesn't do anything

5 votes
1 answer
2087 views
chmod not working
[vagrant@localhost vagrant]$ sudo chmod 755 luser-demo01.sh
[vagrant@localhost vagrant]$ ls -l
total 5
-rwxrwxrwx 1 vagrant vagrant  101 May 30 19:44 luser-demo01.sh
-rwxrwxrwx 1 vagrant vagrant 3464 May 30 19:16 Vagrantfile
[vagrant@localhost vagrant]$ chmod 755 luser-demo01.sh
[vagrant@localhost vagrant]$ ls -l
total 5
-rwxrwxrwx 1 vagrant vagrant  101 May 30 19:44 luser-demo01.sh
-rwxrwxrwx 1 vagrant vagrant 3464 May 30 19:16 Vagrantfile
[vagrant@localhost vagrant]$
I am trying to change file permissions for the above .sh file from 777 to 755 using chmod, but it's not working. I have tried using other permissions like 600 and 666 with chmod but the file permissions never change. I'm using CentOS 7. My commands are the following: sudo chmod 755 or chmod 755 . I was recommended to use chown to gain ownership of the file. However, after trying that, I see that even that is not working as expected. I am attaching an image below for reference. I am probably using the commands wrong. Here as you can see the owner of the file is vagrant not root
[vagrant@localhost vagrant]$ chown -c root luser-demo01.sh
changed ownership of 'luser-demo01.sh' from vagrant to root
[vagrant@localhost vagrant]$ ls -l
total 5
-rwxrwxrwx 1 vagrant vagrant  101 May 30 19:44 luser-demo01.sh
-rwxrwxrwx 1 vagrant vagrant 3464 May 30 19:16 Vagrantfile
[vagrant@localhost vagrant]$
The output of the findmnt command is as follows: [vagrant@localhost vagrant]$ findmnt -T /vagrant TARGET SOURCE FSTYPE OPTIONS /vagrant /vagrant vboxsf rw,nodev,relatime /vagrant vagrant vboxsf rw,nodev,relatime
Asked by TechieMon (61 rep)
May 30, 2024, 09:18 PM
Last activity: Jun 2, 2024, 12:56 AM