I'm trying to get some blogging software up on an organizational remote server. I tried to set up a SSH Key but was having problems and decided that getting the blog up and running was more important than dealing with the SSH Key issue, so I ssh-keygen -R remoteserver.com.

Now I can successfully login with ssh -v remoteuser@remoteserver.com and the correct password. Once logged in I can move around and read any file and directory that I should be able to read.

But when I try to edit an existing -rw-r--r-- file with VIM, it shows up as read-only, if I try to edit permissions I get chmod: file.ext: Operation not permitted, and if I try to scp a new file from my local machine I'm prompted for the remote user's password, and then get scp: /home/path/to/file.ext: Permission denied.

Since I didn't have any of these problems before I tried to set up the ssh key, I suspect these anomalies are a side effect of that, but I don't know how to troubleshoot this. So what does a foolish server-newb, such as myself, need to do to get edit capability back as a remote user?

Addendum 1:

My userids are different between my local machine and the remote server.

For ssh I ssh -v remoteuser@remoteserver.com.

if I whoami I get remoteuser

For scp I scp file.ext remoteuser@remoteserver.com:/path/to/file.ext from the local directory with file.ext while logged in as the local user.

Addendum 2:

In the past I've set up ssh-keys for git repositories. I don't want to completely destroy them, so in an attempt to follow a deer's train of thinking I renamed my ~/.ssh/ to ~/.ssh-bak/, then tested the different types of access. The abridged version of the terminal commands and results is below; I think everything is working until the 8th line from the end.

What is your userid and id on the remote server, and what does ls -l show for the file you can't change?
–
ott--Feb 12 '12 at 19:11

when you say, you didn't have any problems before, what was the before situation?
–
Tom HFeb 13 '12 at 0:01

@TomH - Before I started mucking around with ssh-keys I was able to edit files from the remote server and upload new files to the remote server. I had problems implementing an ssh-key for the server in question, and when I tried to revert to the non-ssh-key login method I had previously been using, I lost write capability, but I can still read.
–
YANewbFeb 13 '12 at 1:54

This is so bizarre. Are you sure the filesystem is mounted read-write? Run mount. Can you also show the contents of the authorized_keys file?
–
cjcFeb 13 '12 at 2:13

3 Answers
3

This is purely a permissions problem. The user "remoteuser" on "remoteserver" doesn't have permissions to write files to /home/www/remotedirectory/phpinfo.php. See this error in your scp -v .. commands output:

Your user account on the remote host probably does not have write permissions to the /home/www/remotedirectory/ directory. You can test this by running:

scp -v phpinfo.php remoteuser@remoteserver.com:/tmp/phpinfo.php

Once this has been confirmed to work, you can set permissions and/or ownership on that directory. For a quick fix, chmod 777 /home/www/remotedirectory/ as root will work, but this is not a secure solution. Depending on how the server is used, better would be to change the directory's group using chgrp to a group that you want all writers to that directory to be in and chmod g+w /home/www/remotedirectory/