Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
1. drwxr-xr-x 10 tester test 100 Sep 8 09:30 hello
2. -rwsrwsrwt 2 tester test 100 Sep 8 09:35 program
I want to know the permissions of the folder "hello" and the file "program", the following is my interpretation, am i right?
About the directory “hello”, the tester user has read, write and execute permission, the test group and others have read and execute permission but no write permission.
About the file "program", the tester user, test group and others have full permissions.
Yes, but your program also has the setuid, setguid and sticky bits set. Read here and here about what they mean. Sticky bit use on executables is very rare these days and normally only on directories such as /tmp
With unix directories x means access not execute, but yes for the directory "home":
user "tester" can read the contents of the directory, change the contents of the directory and change into the directory via the cd command
the group "test" may read the contents of the directory and change into the directory via the cd command
every other user may the contents of the directory and change into the directory via the cd command
For the file "program":
the user "tester", the group "test" and anybody else have the full set of rights and the programm will be executed under the uid of user "tester" (SUID-bit) and the group "test" (SGID-bit) and the sticky bit is also thrown in. This is not used on files any longer, only on directories like /tmp to prevent users from beeing able to delete some other users files.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
Created a directory as root and changed its permissions to 0766:
drwxrw-rw- 2 root root 4096 Aug 2 13:33 test/
When running touch test/test.txt as a user, I get error: touch: cannot touch 'test/test.txt': Permission denied.
$getfacl /test
getfacl: Removing leading '/' from absolute path names
# file: test
# owner: root
# group: root
user::rwx
group::rw-
other::rw-
The directory is set with write permission to all users, what am I missing?
For directories the bits of the access rights have a different meaning than for files:
x means that files inside the directory may be accessed.
r means that you can list the names of the files inside directory. If r is set but x is not set, ls can list the names of the files and sub-directories inside the directory; however, ls cannot show you more information if x is not set; not even if some file it is a regular file or a sub-directory.
w is required to rename or to delete files or to create files or sub-directories inside the directory. However, w has no effect if x is not set!
0766 directory
Because x is not set for group and others, this is the same as a 0744 directory:
Other users may list the names of files and sub-directories inside the directory, but they cannot do more: They cannot even see if some file inside the directory is a regular file or a sub-directory.
You might have an Access Control List (ACL), which permits the access to your folder.
I don't know very much about those lists, but this link should explain them https://www.redhat.com/sysadmin/linux-access-control-lists
You can view the ACL using the getfacl command
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I had a brilliant idea to change my /usr file permissions to 0744 using 'sudo chmod 0744 /usr' while I was trying to install a program. So now I can't access any of my files, my home directory 'home/username' doesn't exist apparently (which isn't true), and all commands that are located in the /usr/bin folder are 'do not exist', which also isn't true.
I think the reason for the commands not existing is because I don't have write/execute permissions on the /usr/bin folder (owned by root), but I don't know why my home folder 'does not exist'.
My question is what exactly have I done, and how do I fix it, if possible?
As a side note, the computer is now having a problem when I try to turn it on. It immediately goes to a blinking cursor (top left) and black screen, but I can ssh into the machine. Finally, I don't have access to the root user or a root shell on this machine.
Solved:
So what happens when you run a command like sudo chmod 744 /usr is that all users on the network get locked out of the home folders as well as making it impossible for the computer to boot (hence the black screen with a blinking cursor). Also, more technically, your root file system (/dev/sda1 for me) becomes read-only.
Since you can't boot the computer, you need to go into single user mode from the grub menu. Next, run the command mount -o remount, rw /dev/(your root file system, possibly sda1). This will remount your root file system as read only. Then, run the command chmod 755 /usr. This will of course change the file permissions to read,write, and execute for the owner of the files and read/execute for group and world users.
You need to login as root, or boot the computer into single-user mode, and then execute:
chmod 755 /usr
You won't be able to do this with sudo because that command is in /usr, and without execute permission you can't access anything in it.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I got a testdir by mkdir testdir, and created a file in it by touch testdir/a.
drwxr-xr-x 2 jermaine jermaine 4096 Mar 12 22:57 testdir
If I remove the 'x' by chmod -x testdir
Then I won't be able to
cd testdir
touch testdir/b
ls -l testdir
cat testdir/a
So my question is why can't I list the file hierarchy under a directory with a 'r' but without an 'x'? What exactly does the 'x' mean on directory?
I knew some explanations like "x means entering the direcotry, you have to enter before read and write". But what does 'enter' mean? I really appreciate answers on inode or dentry level. Thanks a lot.
"Execute" is the traversal permission on a directory. It allows you to access files and folders within the directory.
If you can read a directory, you can list the contents.
If you can write a directory, you can make new files and folders within it.
If you can "execute" a directory, you can move through the hierarchy, even if you don't know what's inside.
When applying permissions to directories on Linux, the permission bits have different meanings than on regular files.
The write bit allows the affected user to create, rename, or delete files within the directory, and modify the directory's attributes
The read bit allows the affected user to list the files within the directory
The execute bit allows the affected user to enter the directory, and access files and directories inside
Execute permission on a directory means you can access files in that directory.
Check this link out for more information about Unix permissions:
http://www.cyberciti.biz/faq/how-linux-file-permissions-work/
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am using opensuse for my production environment.
I am login as "test" user and trying to edit a file using "vi" but when i am going to save
that file it shows the following error
**
E138: Can't write viminfo file /home/test/.viminfo
**
Under the "test" user all the files and folder autometically become read-only.
I am trying to change the permission using "root" user but unable to change it.
also I look for temp file like "~/.viminf*" but there nothing like this.
Don't know what to do plaese help....
anyone aware about this problem
Fix your home directory owner and permissions.
sudo chown -R test /home/test
sudo chmod u+rw -R /home/test
And finally check that no old temp files were left behind (e.g. ~/.viminf*) and that you can write in the directory of the .viminfo file.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
when trying to delete file, I got the rm command on ubuntu page at https://help.ubuntu.com/community/DeletingFiles. And on, this page I got the term read-only files. I have tried to google read-only file linux, but cannot find any definition about this. Could you tell me what read-only mean? Does it mean all owner, group and other have only read permission? Thank you!
Does it mean all owner, group and other have only read permission?
They may have different permissions. But you (the current user) have only read permission.
Linux has three kind of permission for user, group and others.
r: read permission
w: write permission
x: execute permission
If the file is read-only, it means you (the user) don't have the w permission on it and so you cannot delete the file.
Use:
chmod +w FILE
To add that permission. You can change files permission only if you're the owner of the file.
Otherwise, you can remove the file using sudo, gaining super user privilege.
sudo rm FILE
It will prompt you for a password and it will works only if you're in the /etc/sudoers/ file (and you're likely to be there if you're the only user, since you're using Ubuntu).
A read-only file is a file that you don't have permission to alter its content. To see detailed info about your permissions use ls -l; if you want to change the permissions, use chmod. Also see this example for better understanding.
Change the Permissions with chmod or try with sudu:
sudo rm file.xxx