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
[email protected] 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
[email protected].
if I whoami I get remoteuser
For scp I scp file.ext
[email protected]:/path/to/file.ext from the local directory with file.ext while logged in as the local user.
if I whoami I get localuser
The ls -l for two different files I've tried scp:
-rw-r--r--@ 1 localuser localgroup 20 Feb 11 21:03 phpinfo.php
-rw-r--r-- 1 root localgroup 4 Feb 11 22:32 test.txt
The ls -l for the file I've tried to VIM:
-rw-r--r-- 1 remoteuser remotegroup 76 Jul 27 2009 info.txt
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.
localcomputer:~ localuser$ ssh -v
[email protected]
OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to remoteserver.com [###.###.###.###] port 22.
debug1: Connection established.
debug1: identity file /Users/localuser/.ssh/identity
type -1
debug1: identity file /Users/localuser/.ssh/id_rsa
type -1
debug1: identity file /Users/localuser/.ssh/id_dsa
type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p2 FreeBSD-20110503
debug1: match: OpenSSH_5.8p2 FreeBSD-20110503 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
The authenticity of host 'remoteserver.com (###.###.###.###)' can't be established.
RSA key fingerprint is ##:##:##:##:##:##:##:##:##:##:##:##:##:##:##:##.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'remoteserver.com,###.###.###.###' (RSA) to the list of known hosts.
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/localuser/.ssh/identity
debug1: Trying private key: /Users/localuser/.ssh/id_rsa
debug1: Trying private key: /Users/localuser/.ssh/id_dsa
debug1: Next authentication method: password
[email protected]'s password:
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Requesting
[email protected]
debug1: Entering interactive session.
Last login: Sun Feb 12 18:00:54 2012 from 68.69.164.123
FreeBSD 6.4-RELEASE-p8 (VKERN) #1 r101746: Mon Aug 30 10:34:40 MDT 2010
[remoteuser@remoteserver /home]$ ls -l
total ###
-rw-r--r-- 1 remoteuser remotegroup 76 Aug 12 2009 info.txt
[remoteuser@remoteserver /home]$ vim info.txt
~ {at the bottom of the VIM screen it tells me it's [read only]}
[remoteuser@remoteserver /home]$ whoami
remoteuser
[remoteuser@remoteserver /home]$ logout
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype
[email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to remoteserver.com closed.
Transferred: sent 3872, received 12496 bytes, in 107.4 seconds
Bytes per second: sent 36.1, received 116.4
debug1: Exit status 0
localcomputer:localdirectory name$ scp -v phpinfo.php
[email protected]:/home/www/remotedirectory/phpinfo.php
Executing: program /usr/bin/ssh host remoteserver.com, user remoteuser, command scp -v -t /home/www/remotedirectory/phpinfo.php
OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to remoteserver.com [###.###.###.###] port 22.
debug1: Connection established.
debug1: identity file /Users/localuser/.ssh/identity
type -1
debug1: identity file /Users/localuser/.ssh/id_rsa
type -1
debug1: identity file /Users/localuser/.ssh/id_dsa
type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p2 FreeBSD-20110503
debug1: match: OpenSSH_5.8p2 FreeBSD-20110503 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'remoteserver.com' is known and matches the RSA host key.
debug1: Found key in /Users/localuser/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/localuser/.ssh/identity
debug1: Trying private key: /Users/localuser/.ssh/id_rsa
debug1: Trying private key: /Users/localuser/.ssh/id_dsa
debug1: Next authentication method: password
[email protected]'s password:
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Requesting
[email protected]
debug1: Entering interactive session.
debug1: Sending command: scp -v -t /home/www/remotedirectory/phpinfo.php
Sending file modes: C0644 20 phpinfo.php
Sink: C0644 20 phpinfo.php
scp: /home/www/remotedirectory/phpinfo.php: Permission denied
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 1456, received 2160 bytes, in 0.6 seconds
Bytes per second: sent 2322.3, received 3445.1
debug1: Exit status 1