LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Changing group ownership (https://www.linuxquestions.org/questions/linux-networking-3/changing-group-ownership-603094/)

rayn0r 11-28-2007 04:03 PM

Changing group ownership
 
Hi there,

In Red Hat, I would like to know how to change the group ownership of a specific directory (not in GUI). I need to set chmod to 700 as well for one of the directories.

Here are my problems:

1) change group ownership for .ssh directory from root to "x"
2) change permission for .ssh to –rwx------ (chmod 700)
3) change group ownership for authorized_keys file from root to "x"
4) change file permission for authorized_keys (chmod 640 authorized_keys)

Can someone give any info on how this is to be done? I have root access.

harry edwards 11-28-2007 04:35 PM

You could use the find command, for example:

1) change group ownership for .ssh directory from root to "x"

A find command piped into sed or awk should do this.

2) change permission for .ssh to –rwx------ (chmod 700)

Code:

find /home -type f -name ".ssh" -exec chmod 0700 {} \;
3) change group ownership for authorized_keys file from root to "x"

Again sed/awk

4) change file permission for authorized_keys (chmod 640 authorized_keys)

Code:

find /home -type f -name "authorized_keys" -exec chmod 0640 {} \;
I'll have a think about 1 & 3 on how to achieve this.


All times are GMT -5. The time now is 10:48 PM.