Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am following these steps in setting up a public/private key set on my server:

Modify the permissions on the public key by entering the following commands, one by one, on your Linode. Replace example_user with your username.

chown -R example_user:example_user .ssh
chmod 700 .ssh
chmod 600 .ssh/authorized_keys

But when i do the first line

chown -R david:david .ssh

I get the error message:

 changing ownership of '.ssh/authorized_keys': Operation not permitted

I have followed the steps of the guide, except the fact I am using windows so I had to use windows scr to upload the public key rather than the unix command line.

Here are the file information bits:

  File: `.ssh/authorized_keys'
  Size: 294             Blocks: 8          IO Block: 4096   regular file
Device: EDITED OUT    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-03-17 16:32:06.000000000 +0000
Modify: 2013-03-17 16:32:06.000000000 +0000
Change: 2013-03-17 19:06:14.000000000 +0000
share|improve this question
What type of filesystem is your .ssh folder on? Does the filesystem support ownership? Some don't, (e.g. fat, some network fs, etc). – Zoredache Mar 17 '13 at 19:37
Why use the root account to administer the files of an ordinary user? If you instead use the david account for file transfer as well as login there will be no need to chown any files. – Henrik Carlqvist Jan 13 '15 at 7:50
File owner is root: Uid: ( 0/ root) Gid: ( 0/ root) Try to do sudo chmod as already mentioned. – Dirge Jan 13 '15 at 8:54

It looks like you don't have permissions to change ownership of that file. My guess, whatever filesystem you transferred the file from has different kind of privileges that didn't get transferred correctly, and just ended up owning the document to root. Try the same chown command again with sudo (as in, sudo chown -R david:david /path/to/.ssh). Whenever using a command with sudo, it is best practice to use the absolute path (e.g., /home/david/.ssh) instead of the relative path ( ./.ssh ).

share|improve this answer
I tried that and it says, sudo command not found. Any ideas? :) – david Mar 17 '13 at 19:45
Become root using su -, then try the command again. – Scrivener Mar 17 '13 at 21:47

su -c "chown david:david ~david/.ssh/authorized_keys"

at this point you will be asked the password for root and hopefully you know the root password for this machine. Otherwise, you have steep hill to climb ahead of you, in the lack of sudo.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.