When copying in linux do permissions and owners persist? [closed] - linux

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 9 years ago.
Improve this question
When I copy with a command such as:
cp -R /myfolder /home/backup/
Will the permissions such as 775 (drwxr-xr-x) persist?
Will the owner 'danny:danny' persist, or will the owner change to the person who actually made the copy?

you can run cp -a to preserve the ownership. Note that to preserve root permissions, you must run with sudo.
Without this flag, ownership is not preserved.

If a user copy a file he will become the owner of it.
$ mkdir d1 && touch d1/f1
$ sudo cp -R d1 d2
$ ls -l
drwxr-xr-x 2 root root 4096 Oct 28 17:58 d2
$ ls -l d2/
-rw-r--r-- 1 root root 0 Oct 28 17:58 f1

It is cp -p to preserve the timestamps,ownership and permissions check out http://unixhelp.ed.ac.uk/CGI/man-cgi?cp
Thanks & Regards,
Alok Thaker

Related

difference between /bin/ls and /usr/bin/ls [closed]

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 1 year ago.
Improve this question
It seems that both /bin/ls and /usr/bin/ls have the same inode (and the same sha-256 hash) but the number of hard links displayed by ls -li /usr/bin/ls /bin/ls is 1 instead of 2 :
user#debian:~/Documents/Unix$ ls -lai /usr/bin/ls /bin/ls
8258848 -rwxr-xr-x 1 root root 147176 24 sept. 2020 /bin/ls
8258848 -rwxr-xr-x 1 root root 147176 24 sept. 2020 /usr/bin/ls
Could somebody explain me what I have misunderstood?
I was puzzled for a while by this too, until I discovered this:
$ ls -ld /bin
lrwxrwxrwx 1 root root 7 May 31 02:39 /bin -> usr/bin
So /bin is just a symlink to /usr/bin, and there is really only one link to the file.
There are no differences between ls utility. You should know the difference is only between /bin and /usr/bin directories. /bin directory contains all programs that are used by system admin and all others users. /bin directory we can access whenever we want, but /usr/bin is accessible only for users that are locally logged.

Could not acces to home directory /home/user01: Permission denied [closed]

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 3 years ago.
Improve this question
I created a new username called user01. Then, I used usermod to grant permissions with another user.
After that, I logged out and login as user 02 but can access to /home/user01
[user02#SRV01 ~]$ cd /home/user01/
-bash: cd: /home/user01/: Permission denied
I checked the directory and permisions of /home/user01 and user by this commands:
[user02#SRV01 ~]$ ls -ltrh / | grep home
drwxr-xr-x. 10 root root 4,0K feb 19 2019 home
[user02#SRV01 ~]$ ls -ltrh /home | grep user01
drwxrwxr-x+ 17 user01 user01 4,0K nov 26 18:14 user01
root#SRV01 /home # id user02
uid=509(user02) gid=500(user01) grupos=500(user01),511(user02)
What's the exactly problem? Thank's in advance
The plus sign at the end in the listing of user01 directory implies the use of ACL. (Access Control Lists)
For more information on the permissions, use getfacl command.
That should show that the user02 has read-execute access on the directory user01.
If the appropriate setting is not there, you'll need to do that using setfacl.
For example,
setfacl -m u:user02:x user01
setfacl -m u:user02:r user01
I hope this works!
You can play around with them after reading more on man page of the getfacl/setfacl commands.

Can't cd into 770 directory even though I'm in the group - complicated by IPA [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 4 years ago.
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.
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.
Improve this question
Boy howdy, I'm kind of scratching my head over this.
I have a directory with 770 permissions:
inger#server$> ls -ld mydir
drwxrwx--- 2 root mygroup1 4096 May 22 05:27 mydir
I can't cd into it:
inger#server$> cd mydir
-bash: cd: mydir: Permission denied
Hmm, okay, I guess I'm not in the mygroup1 group, right? Wrong:
inger#server$> groups inger
inger: inger [a bunch of other groups] mygroup1 mygroup2 mygroup3
...confirming with getent
inger#server$> getent group mygroup1
mygroup1:*:1903:inger,[a bunch of other users]
...Maybe there's some mixup with the GID of mygroup1? Nope:
inger#server$> ls -nd mydir
drwxrwx--- 2 0 1903 4096 May 22 05:27 mydir
If I chown the group to root:mygroup2, I can get in just fine:
inger#server$> sudo -s
root#server:# chown root:mygroup2 mydir
root#server:# ls -ld mydir
drwxrwx--- 2 root mygroup2 4096 Aug 15 09:44 mydir
root#server:# exit
inger#server$> cd mydir
^^ that works
There are no special ACLs overriding normal UNIX perms:
inger#server$> getfacl mydir
# file: mydir
# owner: root
# group: mygroup1
user::rwx
group::rwx
other::---
This directory doesn't have a special NFS mount or anything - it shares a mount with other directories, none of which have this problem, but they also aren't owned by mygroup1.
So, the problem appears to be specific to this group.
This problem was discovered this morning - members of mygroup1 could get into mydir just fine yesterday.
We manage users and groups with FreeIPA, and yesterday I added some new users to the mygroup1 group. But I added users to the mygroup2 group as well, and there are no problems with that.
Anyone have any recommendations?
This is a limitation with certain NFS configurations where your group memberships after the 16th group are ignored when resolving permissions. Here is a good writeup on it.

unable to change the permisson of an file in linux [closed]

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 9 years ago.
Improve this question
Unable to change the permission of the cgi-bin. I want that folder to have write option for user too
abc#abc:~/public_html> ls -l
total 12
drwxr-xr-x 2 root root 4096 2013-10-24 11:16 cgi-bin
-rw-r--r-- 1 john users 835 2013-10-24 15:54 index.html
when i write
abc#abc:~/public_html> chmod 770 cgi-bin
error:
chmod: changing permissions of `cgi-bin': Operation not permitted
you should use
sudo chmod 770 cgi-bin
or to recursively change all files in the folder
sudo chmod -R 770 cgi-bin
You can also use this
$ sudo chmod -R 777 dirpath/filename

Chown not working [closed]

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 7 years ago.
Improve this question
On Ubuntu 12.04, the chown command doesn't seem to be working like it should
root#server:/var/www/folder/# ls -al
Running this puts out
drwxr-xr-x 11 776 sftponly 4096 Feb 17 14:08 Other_Folder
I need write permissions for the group, so I run:
chown -R 776 ./Other_Folder
Then when I run ls -al again, the output is still
drwxr-xr-x 11 776 sftponly 4096 Feb 17 14:08 Other_Folder
chown is used to change ownership of the file, not change permissions.
ls -al is not showing you who owns the file, just its permissions.
If root owns those files, you'll need to chown them properly, before you can change their permissions:
chown -R yourname:yourname folderName
Then as the owner you can change their permissions:
chmod -R 776 folderName
Edit:
I double checked the syntax and it seems to be right, you'll likely need to use sudo to use them.

Resources