Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Permission denied


    I want to change the ownership of the directory /home/ana to myself (ana). I try to perform this as root :

    #chown -R ana /home/ana

    However, I get these errors :

    chown : cannot read directory '/home/ana/.ssh' : Permission denied
    chown : changing ownership of '/home/ana' : Operation not permitted
    I have also checked the current users logged into the system. This is the output I get :

    # users
    mbh mbh root
    When I type :

    # exit

    to exit the current user logged in, it exits the shell and goes back to prompting the user for login (the name of the server is banana :

    banana login :
    What could be wrong? Why can't I change the ownership of /home/ana even as root?

  2. #2
    Linux Engineer
    Join Date
    Jan 2005
    Saint Paul, MN
    The permissions on "/home/ana/.ssh" are set (and need to be set) to owner access only. Which means that only the "user name" the owns the directory can use/modify the directory. This is present for security. If others could have access to the directory, they would have access to your "private key" which is NOT to be distributed.

    The question being raised is how did you get your home directory owned by some other user?

  3. #3
    Linux Enthusiast sgosnell's Avatar
    Join Date
    Oct 2010
    Baja Oklahoma
    If you log in as ana, then /home/ana should already be owned by you. If you log in as another user, which it appears you have, then /home/ana doesn't belong to you, but to ana.

  4. $spacer_open
  5. #4
    Unfortunately, that directory does not belong to me (ana). It belongs to some id '1612'.

    banana]#ls -ld ~/.ssh
    drwx------ 2 1612 nta 4096 2013-11-06 20:24 /home/ana/.ssh
    Therefore I thought I would be able to change the ownership as root user, which obviously, was not successful.

    Would it possible to atleast change the permission of others to '7' (temporarily) as root user? This is so that I will be able to change the ownership of that folder as root user, to ana. Then once this changes are done, I will revoke the permission of others?

  6. #5
    Quote Originally Posted by anaigini45 View Post
    Unfortunately, that directory does not belong to me (ana). It belongs to some id '1612'.
    As root :

    adduser -r -u 1612 -m -o backana
    This will add a user to your system. This user will be named backana, it will be an administrative member (the -r), will have the uid 1612 (the -u), even if a user with uid 1612 exist (the -o) and will have a /home/backana directory (the -m, allowing him to log in locally).

    Once done, login to as backana, then

    chmod -R 0755 /home/ana
    chown -R ana /home/ana
    After those operations, it might work as you expected. But don't forget that you now have a new user. If you want to disable it, then as root :

    adduser -u 1612 -e TODAY_DATE+1 backana
    In the above code, you surely have understood that you have to replace TODAY_DATE+1 by the date of the day plus one day, making the account to expire (the -e) tomorrow.

    Hope it will help you.

  7. #6
    i have this probleme to but now work great

Posting Permissions

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