Results 1 to 10 of 10

Thread: help with chmod go-rwx ~

  1. #1
    Join Date
    Sep 2009
    Beans
    13

    help with chmod go-rwx ~

    I am on the admin account of my computer and am trying to remove all privileges from CWD i have tried

    chmod go-rwx ~
    sudo chmod go-rwx ~

    but when i pull up

    ls -l ~

    It is still showing permission in the g and o column. Help much appreciated.

  2. #2
    Join Date
    Dec 2006
    Location
    Chicago
    Beans
    3,839

    Re: help with chmod go-rwx ~

    Quote Originally Posted by Michaeljs1990 View Post
    I am on the admin account of my computer and am trying to remove all privileges from CWD i have tried

    chmod go-rwx ~
    sudo chmod go-rwx ~

    but when i pull up

    ls -l ~

    It is still showing permission in the g and o column. Help much appreciated.
    If you're trying to change the permissions on the files and directory inside your home folder (not just the home directory itself), you need to make it recursive.
    Code:
    chmod -R go-rwx ~
    man chmod

  3. #3
    Join Date
    Jun 2008
    Location
    Colombia
    Beans
    443

    Re: help with chmod go-rwx ~

    Are you trying to prevent other users from accessing your home folder? If that's the case then
    Code:
    chmod 700 /home/$USER
    And add the -R flag if you want it recursive.

  4. #4
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    chmod go-rwx .

    Quote Originally Posted by Michaeljs1990 View Post
    ... remove all privileges from CWD ...
    Current working directory (CWD) is a dot (.) not a tilde (~)

    Code:
    # remove *all* privileges from CWD, which may not be what you want
    chmod u=,g=,o= .
    
    # remove *all* privileges from CWD, except for the owner
    chmod u=rwx,g=,o= .

  5. #5
    Join Date
    Jan 2008
    Location
    USA
    Beans
    971
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: help with chmod go-rwx ~

    Quote Originally Posted by Michaeljs1990 View Post
    I am on the admin account of my computer and am trying to remove all privileges from CWD i have tried

    chmod go-rwx ~
    sudo chmod go-rwx ~

    but when i pull up

    ls -l ~

    It is still showing permission in the g and o column. Help much appreciated.
    What do you mean by "removing all permissions?" If you want to just stop others from seeing your files, you need to do as the guy above said:

    Code:
    sudo chmod -R 0700 <directory>
    This will result in only the owner (and root) of the directory having access.

  6. #6
    Join Date
    Sep 2009
    Beans
    13

    Re: help with chmod go-rwx ~

    Thank you for the help the command that finally worked was
    sudo chmod -R go-rwx /home/michael
    For some reason as i am not a unix expert so it probably makes sense when i use ~ or . as Lars said it wont change my CWD. However when you write it out chmod -R says "chmod: cannot access `./.gvfs': Permission denied" even with sudo in front it does the same thing. also to Lars i would like to say in my unix shell
    ls -l ~
    &
    ls -l .
    both bring up the same list
    thank you for your help if someone could clear up why ~ and . wont work when changing permission it would be much appreciated. also why chmod -R brings back that error message ever time.
    Last edited by Michaeljs1990; January 21st, 2010 at 10:23 PM.

  7. #7
    Join Date
    Dec 2006
    Location
    Chicago
    Beans
    3,839

    Re: help with chmod go-rwx ~

    That error about ~/.gvfs is normal. That hidden directory is used for mount points when you mount a network share with nautilus. You cannot change the permissions on it, nor should you. Also, root cannot access that directory. If you have mounted shares with nautilus, you might want to be careful what recursive commands you use on your home directory, as they could modify those shares as well.

    "~" and "." will work, and probably did, you simply weren't listing the permissions of that directory when you first tried to use it.
    Code:
    chmod 700 ~
    ls -ld ~

  8. #8
    Join Date
    Sep 2009
    Beans
    13

    Re: help with chmod go-rwx ~

    as you can see from my last post i was a little confused about what was going on i must have been putting in something wrong because now it works perfectly
    sudo chmod -Rv go-rwx ~ (~ . and /home/(name of your CWD) all work)
    sudo chmod -Rv go+rwx ~ (to give all permission back)

    the -v argument just shows that it is actually changing it and gives you a print out. Thank you again (lol) it was really bugging me that i couldn't get it to work right. I will sleep well tonight . Ubuntu community = AWESOME

  9. #9
    Join Date
    Dec 2006
    Location
    Chicago
    Beans
    3,839

    Re: help with chmod go-rwx ~

    Quote Originally Posted by Michaeljs1990 View Post
    as you can see from my last post i was a little confused about what was going on i must have been putting in something wrong because now it works perfectly
    sudo chmod -Rv go-rwx ~ (~ . and /home/(name of your CWD) all work)
    sudo chmod -Rv go+rwx ~ (to give all permission back)

    the -v argument just shows that it is actually changing it and gives you a print out. Thank you again (lol) it was really bugging me that i couldn't get it to work right. I will sleep well tonight . Ubuntu community = AWESOME
    CWD = current working directory. This can be your home directory, depending on if you have changed the CWD with the "cd" command. In the terminal, a "." means the CWD.

    recursive = Traversing the contents of a directory to perform an action on all files or directories contained within a directory. A "-R" switch is often used by commands to make it recursive. Refer to the command's manpage.

    ~ = home directory. This is typically a directory named after the user contained in /home. When you start a new terminal, the CWD is your home directory initially, but can be changed at any point.

  10. #10
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    cwd vs $HOME

    Quote Originally Posted by Michaeljs1990 View Post
    ... also to Lars i would like to say in my unix shell
    ls -l ~
    &
    ls -l .
    both bring up the same list
    That would be because when you are in your own home directory the two are the same. ~ is a shortcut for the value stored in the environment variable $HOME. By the way "ls" by itself without any parameters is a shortcut for "ls ."

    Code:
    # print name of current (working) directory
    pwd
    
    # print name registered as home directory
    echo $HOME
    To see the difference:

    Code:
    # change directory
    cd /usr/bin
    
    # see what's there
    ls .
    
    # see what's in your home directory
    ls ~

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •