Using ssh on WD My Book World Edition Whitelight
I am following https:/
ssh-copy-id -i ~/.ssh/id_rsa.pub <REMOTE_
I receive this error
bash: /shares/
I have triple-checked my password for the user I have created, and it is fine (and I have also made the user an Admin, and that doesn't help). Does anybody have any suggestions as to where I am going wrong (I have followed all of the steps very carefully, several times!). Germar?
Many thanks! Martin
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Martin Fisher
- Solved:
- Last query:
- Last reply:
Revision history for this message
|
#1 |
Hi Martin,
does the folder '/shares/
If ssh-copy-id still fail you can also do that manually:
cat ~/.ssh/id_rsa.pub | ssh <REMOTE_
Regards,
Germar
Revision history for this message
|
#2 |
Hi Germar
Many thanks! I can't understand the problem I have. Here is what I receive if I try to login with ssh:
martin@martin:~$ ssh martin@192.168.0.7 martin@
-bash: /etc/profile: Permission denied
-bash-3.2$
I know the pwd is ok because I can use it to log in as this user via the web interface. If I then run
-bash-3.2$ mkdir .ssh
mkdir: Cannot create directory `.ssh': File exists
I am a little lost!
With thanks for any advice, Martin
Revision history for this message
|
#3 |
Please try 'ssh root@192.168.0.7 chmod 644 /etc/profile'
I'm little short on time today. So if this doesn't fix it I'll try to help you tomorrow again.
Regards,
Germar
Revision history for this message
|
#4 |
Hi Martin,
any news from your MyBook? Does it work now? I would appreciate your feedback so I could extend the FAQ.
Regards,
Germar
Revision history for this message
|
#5 |
Hi Germar
Sorry I didn't reply earlier, I had difficulty finding the time. As I have nothing of importance on the drive (yet!) I have started again. I made it through the FAQ without a problem until I reach section (3). When entering 'chmod 700 .ssh' I received the message 'chmod: .ssh: No such file or directory'. Therefore I used 'mkdir .ssh; chmod 700 .ssh' from your post above. This went fine. However, when I try to log in I am still asked for my password and trying 'ssh <REMOTE_
I would be happy to receive any further advice!
Yours, Martin
Revision history for this message
|
#6 |
Hi Martin,
I wrote that FAQ from memory after I set up my own MyBook. I had already some important stuff on that so I couldn't start again from scratch to test if I missed a steps. So, I'm sorry for you struggling with this. This is just because I missed some thing.
The .ssh folder must exist before running ssh-copy-id. If not, ssh-copy-id couldn't copy your public key. You created that folder already. So please continue again with the ssh-copy-id command and follow the steps.
It looks like the PATH environment is also not correct yet. Please log in with your normal user and post the output of these commands:
env
cat /etc/profile
grep $(whoami) /etc/passwd
Sorry again for your problems and sorry for using you as a beta tester.
Regards,
Germar
Revision history for this message
|
#7 |
Hi Germar
No problem at all - this is a great learning experience for me. Now, when I try:
ssh-copy-id -i ~/.ssh/id_rsa.pub <REMOTE_
I receive the response:
bash: /shares/
With grateful thanks, Martin
Revision history for this message
|
#8 |
Okay, so this is the same as in your first post. Please try again:
ssh root@192.168.0.7 chmod 644 /etc/profile
ssh-copy-id -i ~/.ssh/id_rsa.pub martin@192.168.0.7
And if ssh-copy-id still fails try:
cat ~/.ssh/id_rsa.pub | ssh martin@192.168.0.7 'umask 077; cat >>.ssh/
Revision history for this message
|
#9 |
Many thanks: ssh-copy-id still fails, and 'cat...' gives the same error message (bash: .ssh/authorized
Thanks, Martin
Revision history for this message
|
#10 |
Please log in with your normal user and post the output of these commands:
env
cat /etc/profile
grep $(whoami) /etc/passwd
ls -la /shares/martin/
touch /shares/
Revision history for this message
|
#11 |
Here we go:
martin@martin:~$ ssh martin@192.168.0.7
martin@
-bash-3.2$ env
TERM=xterm
SHELL=/opt/bin/bash
SSH_CLIENT=
SSH_TTY=/dev/pts/0
USER=martin
MAIL=/var/
PATH=/opt/
PWD=/shares/martin
SHLVL=1
HOME=/shares/martin
LOGNAME=martin
SSH_CONNECTION=
_=/opt/bin/env
-bash-3.2$ cat /etc/profile
export PATH=/opt/
export PATH=/opt/
export PATH=/opt/
export PATH=/opt/
export PATH=/opt/
-bash-3.2$ grep $(whoami) /etc/passwd
martin:
-bash-3.2$ ls -la /shares/martin/
total 4
drwx------ 3 martin jewab 37 Apr 28 20:40 .
drwxr-xr-x 5 root jewab 4096 Apr 28 17:36 ..
-rw------- 1 martin jewab 0 Apr 28 20:40 .bash_history
drwx------ 2 martin jewab 28 Apr 28 20:57 .ssh
-bash-3.2$ touch /shares/
-bash-3.2$
Revision history for this message
|
#12 |
Looks like you've overriden /etc/profile ( two >> add something to a file, one > overrides the file). Here is my /etc/profile:
https:/
Please replace yours:
ssh root@192.168.0.7 /opt/bin/nano /etc/profile
delete all, copy and paste from github
press CTRL+O and CTRL+X
creating a new .ssh/authorized
cat ~/.ssh/id_rsa.pub | ssh martin@192.168.0.7 'umask 077; cat >>/shares/
Revision history for this message
|
#13 |
Done... but the cat... bash: /shares/
Thanks, Martin
Revision history for this message
|
#14 |
Hmm. Strange. Let's try an other way:
scp ~/.ssh/id_rsa.pub martin@
ssh martin@192.168.0.7
chmod 700 .ssh
chmod 600 .ssh/authorized
Revision history for this message
|
#15 |
Hi Germar - Many thanks for your continuing help. Please see transcript of the session, below:
martin@martin:~$ scp ~/.ssh/id_rsa.pub martin@
Agent admitted failure to sign using the key.
martin@
id_rsa.pub 100% 395 0.4KB/s 00:00
martin@martin:~$ ssh martin@192.168.0.7
Agent admitted failure to sign using the key.
martin@
declare -x DMALLOC_
declare -x EDITOR="/bin/vi"
declare -x HISTFILESIZE="1000"
declare -x HISTSIZE="1000"
declare -x HOME="/
declare -x HOSTNAME=
declare -x INPUTRC=
declare -x LOGNAME="martin"
declare -x MAIL="/
declare -x OLDPWD
declare -x PAGER="/bin/more "
declare -x PATH="/
declare -x PS1="[\\u@\\h \\W]\\\$ "
declare -x PWD="/shares/
declare -x SHELL="
declare -x SHLVL="1"
declare -x SSH_CLIENT=
declare -x SSH_CONNECTION=
declare -x SSH_TTY=
declare -x TERM="xterm"
declare -x USER="martin"
[martin@MyBookWorld ~]$ chmod 700 .ssh
[martin@MyBookWorld ~]$ chmod 600 .ssh/authorized
[martin@MyBookWorld ~]$ exit
logout
Connection to 192.168.0.7 closed.
martin@martin:~$ ssh martin@192.168.0.7
Agent admitted failure to sign using the key.
martin@
Revision history for this message
|
#16 |
Okay, this looks like we are one step forward :)
I'm a bit confused where these 'declare -x ...' come from but lets ignore them for now.
The 'Agent admitted failure to sign using the key.' can have two reasons:
(1) your private key is not yet managed by ssh-agent. Try 'ssh-add ~/.ssh/id_rsa'
(2) for some reason ssh doesn't like if you have an open SSH-connection and transfer the key in this. The workaround I found for this on google is:
mv ~/.ssh/id_rsa ~/.ssh/id_rsa.bak
mv ~/.ssh/id_rsa.pub ~/.ssh/
ssh martin@192.168.0.7
enter your password
exit
than reboot or logout and login again on your local computer
mv ~/.ssh/id_rsa.bak ~/.ssh/id_rsa
mv ~/.ssh/
ssh martin@192.168.0.7
this time you shouldn't need a password anymore
If both methodes doesn't help please run 'ssh -vv martin@192.168.0.7' and post the output in here.
Regards,
Germar
Revision history for this message
|
#17 |
Hi Germar
I tried your option (1) and now I can ssh martin@192.168.0.7 without needing a password. However:
martin@martin:~$ ssh martin@192.168.0.7 cp --help
BusyBox v1.1.1 (2009.12.
Usage: cp [OPTION]... SOURCE DEST
Here is the output of ssh -vv martin@192.168.0.7:
martin@martin:~$ ssh -vv martin@192.168.0.7
OpenSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.0.7 [192.168.0.7] port 22.
debug1: Connection established.
debug1: identity file /home/martin/
debug1: Checking blacklist file /usr/share/
debug1: Checking blacklist file /etc/ssh/
debug1: identity file /home/martin/
debug1: identity file /home/martin/
debug1: identity file /home/martin/
debug1: identity file /home/martin/
debug1: identity file /home/martin/
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH_3.*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: ecdh-sha2-
debug2: kex_parse_kexinit: <email address hidden>,<email address hidden>
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: hmac-md5,
debug2: kex_parse_kexinit: hmac-md5,
debug2: kex_parse_kexinit: none,<email address hidden>,zlib
debug2: kex_parse_kexinit: none,<email address hidden>,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: aes128-
debug2: kex_parse_kexinit: hmac-md5,
debug2: kex_parse_kexinit: hmac-md5,
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_
debug1: expecting SSH2_MSG_
debug2: dh_gen_key: priv key bits set: 123/256
debug2: bits set: 524/1024
debug1: SSH2_MSG_
debug1: expecting SSH2_MSG_
debug1: Server host key: RSA 3f:04:4f:
debug1: Host '192.168.0.7' is known and matches the RSA host key.
debug1: Found key in /home/martin/
debug2: bits set: 501/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_
debug2: key: /home/martin/
debug2: key: martin@martin (0x7f3d21f0f1e0)
debug2: key: /home/martin/
debug2: key: /home/martin/
debug1: Authentications that can continue: publickey,
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/martin/
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug2: input_userauth_
debug1: Authentication succeeded (publickey).
Authenticated to 192.168.0.7 ([192.168.0.7]:22).
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug2: client_
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug1: Sending env LANG = en_GB.UTF-8
debug2: channel 0: request env confirm 0
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 131072
debug2: channel_
debug2: shell request accepted on channel 0
declare -x DMALLOC_
declare -x EDITOR="/bin/vi"
declare -x HISTFILESIZE="1000"
declare -x HISTSIZE="1000"
declare -x HOME="/
declare -x HOSTNAME=
declare -x INPUTRC=
declare -x LOGNAME="martin"
declare -x MAIL="/
declare -x OLDPWD
declare -x PAGER="/bin/more "
declare -x PATH="/
declare -x PS1="[\\u@\\h \\W]\\\$ "
declare -x PWD="/shares/
declare -x SHELL="
declare -x SHLVL="1"
declare -x SSH_CLIENT=
declare -x SSH_CONNECTION=
declare -x SSH_TTY=
declare -x TERM="xterm"
declare -x USER="martin"
[martin@MyBookWorld ~]$ debug1: client_
debug1: client_
Thanks! Martin
Revision history for this message
|
#18 |
Great! So that does work now.
It looks like there are still some problems with your /etc/profile. Please double check if you copied correctly the one that posted in #12. Probably there is a line with a single 'export' which causes these 'declare -x ...' and 'export PATH...' line at the bottom is also missing.
Alternative you can download an copy that directly on your MyBook:
ssh root@192.168.0.7
cd /tmp
wget https:/
tar xvzf download
mv gist17c9dc1eb37
chown root:root /etc/profile
chmod 644 /etc/profile
Regards,
Germar
Revision history for this message
|
#19 |
The command 'mv gist...
Revision history for this message
|
#20 |
I am relatively sure that the /etc/profile was copied across but anyway I followed your instructions to successfully copy from yours (I had to use --no-check-
martin@martin:~$ ssh martin@192.168.0.7 cp --help
BusyBox v1.1.1 (2009.12.
Usage: cp [OPTION]... SOURCE DEST
If you want to throw in the towel on my case at this stage please feel free!
Yours, Martin
Revision history for this message
|
#21 |
Not at all. We are close to finish ;-) and I think I found the missing part. Please try:
ssh martin@192.168.0.7
echo "PATH=/
chmod 600 .ssh/environment
exit
ssh root@192.168.0.7
/opt/bin/nano /etc/sshd_config
search for the line '#PermitUserEnv
if this is not in there just add 'PermitUserEnvi
press CTRL+O and CTRL+X
/etc/init.d/S50sshd restart
exit
ssh martin@192.168.0.7 cp --help
Regards,
Germar
Revision history for this message
|
#22 |
Yay! Thank you Germar, that was the final fix! Phew (says you)...
Now I need to test with BIT to see if I can back up - finally! - over ssh (which I'm sure I will be able to do). I have upgraded to Ubuntu 13.04 and there are not yet an appropriate package at https:/
Once I have tested with BIT I will report back to you.
With warm regards, Martin
Revision history for this message
|
#23 |
Yay! Great! :-)
I'll immediately change the FAQ before I forget again what was missing.
That's right. Packages for raring are missing. They'll come with the next release. Till then you can create your own packages with:
sudo apt-get install bzr gettext fakeroot
bzr branch lp:backintime -r 839
cd backintime
rm -f *.deb
fakeroot ./makedeb.sh
sudo dpkg -i backintime-
sudo apt-get install -f
Kind regards,
Germar
Revision history for this message
|
#24 |
Hi Germar
Many thanks - I am now running my first BIT backup over ssh to the WhiteLight. If all goes well I will then test the edited FAQ, or at least the parts I need to use, to set up another user in the house to backup to the drive.
Yours gratefully, Martin