Announcement

Collapse
No announcement yet.

Setting up SSH on U14.04 Server -- I Messed Up File Ownerships

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Setting up SSH on U14.04 Server -- I Messed Up File Ownerships

    Yep. That's what I get for following the advice from other forums. So what are the default/usual/normal/correct directory and file ownerships?

    [root directory]
    root@server1:/# ll
    total 80
    drwxr-xr-x 21 root root 4096 Aug 3 09:46 ./
    drwxr-xr-x 21 root root 4096 Aug 3 09:46 ../
    drwxr-xr-x 2 root root 4096 Aug 3 09:54 bin/
    drwxr-xr-x 3 root root 4096 Aug 3 10:00 boot/
    drwxr-xr-x 13 root root 4120 Aug 8 07:43 dev/
    drwxr-xr-x 90 root root 4096 Aug 9 00:23 etc/
    drwxr-xr-x 4 root root 4096 Aug 9 00:24 home/
    lrwxrwxrwx 1 root root 33 Aug 3 09:46 initrd.img -> boot/initrd.img-3.13.0-32-generic
    drwxr-xr-x 21 root root 4096 Aug 3 09:54 lib/
    drwx------ 2 root root 16384 Aug 3 09:43 lost+found/
    drwxr-xr-x 6 root root 4096 Aug 7 04:38 media/
    drwxr-xr-x 3 root root 4096 Aug 6 19:44 mnt/
    drwxr-xr-x 2 root root 4096 Jul 22 17:48 opt/
    dr-xr-xr-x 84 root root 0 Aug 8 07:42 proc/
    drwx------ 2 root root 4096 Aug 3 10:22 root/
    drwxr-xr-x 18 root root 640 Aug 8 23:48 run/
    drwxr-xr-x 2 root root 4096 Aug 3 10:01 sbin/
    drwxr-xr-x 2 root root 4096 Jul 22 17:48 srv/
    dr-xr-xr-x 13 root root 0 Aug 8 07:42 sys/
    drwxrwxrwt 3 root root 4096 Aug 9 00:33 tmp/
    drwxr-xr-x 10 root root 4096 Aug 3 09:43 usr/
    drwxr-xr-x 12 root root 4096 Aug 3 09:56 var/
    lrwxrwxrwx 1 root root 30 Aug 3 09:46 vmlinuz -> boot/vmlinuz-3.13.0-32-generic
    [/output]


    Here's the real problem I think:
    [As user, not root, from the home directory]
    mark@server1:~/.ssh$ ll
    ls: cannot open directory .: Permission denied
    mark@server1:~/.ssh$ cd ..
    mark@server1:~$ ll
    total 36
    drwxr-xr-x 4 mark mark 4096 Aug 6 19:26 ./
    drwxr-xr-x 4 root root 4096 Aug 9 00:24 ../
    -rw------- 1 mark mark 5888 Aug 8 14:11 .bash_history
    -rw-r--r-- 1 mark mark 220 Aug 3 10:00 .bash_logout
    -rw-r--r-- 1 mark mark 3637 Aug 3 10:00 .bashrc
    drwx------ 2 mark mark 4096 Aug 3 10:03 .cache/
    -rw-r--r-- 1 mark mark 675 Aug 3 10:00 .profile
    drwx------ 2 700 mark 4096 Aug 6 19:26 .ssh/
    mark@server1:~$
    [/output]

    Somehow I have the owner of the .ssh directory as 700! As mark, I can not access this folder. I want to got back to the correct ownership of these directories. Next time I'll be more careful to use chmod instead of chown.
    "If you're in a room with another person who sees the world exactly as you do, one of you is redundant." Dr. Steven Covey, The 7-Habits of Highly Effective People

    #2
    sudo chown mark.mark .ssh/ -R

    actually, for good measure
    cd /home
    sudo chown mark.mark mark/ -R
    K 14.4 64 AMD 955be3200MHz 8GB 1866Mhz 6TB Plex/samba.etc.+ Macbook Air 13".

    Comment


      #3
      doesn't the -R option come before the names? I'm trying...
      "If you're in a room with another person who sees the world exactly as you do, one of you is redundant." Dr. Steven Covey, The 7-Habits of Highly Effective People

      Comment


        #4
        yep,

        -$ sudo chown -R mark.mark .ssh/
        It worked. Thanks.
        "If you're in a room with another person who sees the world exactly as you do, one of you is redundant." Dr. Steven Covey, The 7-Habits of Highly Effective People

        Comment


          #5
          Yes. While in your user /home directory:

          chown -R mark:mark .ssh
          Windows no longer obstructs my view.
          Using Kubuntu Linux since March 23, 2007.
          "It is a capital mistake to theorize before one has data." - Sherlock Holmes

          Comment


            #6
            Originally posted by mhumm2 View Post
            doesn't the -R option come before the names? I'm trying...
            i dont think it matters, in this case
            K 14.4 64 AMD 955be3200MHz 8GB 1866Mhz 6TB Plex/samba.etc.+ Macbook Air 13".

            Comment


              #7
              CHOWN(1) User Commands CHOWN(1)

              NAME
              chown - change file owner and group

              SYNOPSIS
              chown [OPTION]... [OWNER][:[GROUP]] FILE...
              chown [OPTION]... --reference=RFILE FILE...
              Windows no longer obstructs my view.
              Using Kubuntu Linux since March 23, 2007.
              "It is a capital mistake to theorize before one has data." - Sherlock Holmes

              Comment


                #8
                there's no need for man,

                since : sudo chown mark.mark mark/ -R

                works just fine,

                so what if man says different?

                just try it

                added: i have a suspicion that -R switch 'recursively' can be added at to any command that will accept it.
                Last edited by millusions; Aug 09, 2014, 09:52 PM. Reason: added
                K 14.4 64 AMD 955be3200MHz 8GB 1866Mhz 6TB Plex/samba.etc.+ Macbook Air 13".

                Comment


                  #9
                  It's difficult to argue with success. Thanks. I have my directories corrected. Now on to ssh-agent.
                  "If you're in a room with another person who sees the world exactly as you do, one of you is redundant." Dr. Steven Covey, The 7-Habits of Highly Effective People

                  Comment


                    #10
                    Originally posted by millusions View Post
                    there's no need for man, since : sudo chown mark.mark mark/ -R works just fine, so what if man says different?
                    Please don't discourage people from reading documentation.

                    Some commands accept arguments that themselves take options. A made-up example might be:
                    foocmd --opt1 --opt2 argument1 --opt11 argument2 --opt21

                    If --opt1 were specified at the end, it would affect only argument2 rather than the entire command. The man page expresses the proper convention, because when learning the command line, it's best to learn these conventions early. Having to undo learning is difficult.

                    Originally posted by millusions View Post
                    added: i have a suspicion that -R switch 'recursively' can be added at to any command that will accept it.
                    It can be added to any command whose documentation mentions that it's a supported option. The best way to check? Read the man page for the command.

                    Comment


                      #11
                      fair enough,
                      it just seems logical, to me anyway, to put -R at the end
                      K 14.4 64 AMD 955be3200MHz 8GB 1866Mhz 6TB Plex/samba.etc.+ Macbook Air 13".

                      Comment

                      Working...
                      X