Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.8k views
in Technique[技术] by (71.8m points)

azure - How to login into DC-OS slave through Master

I created DC-OS cluster on azure, after creating with ssh public key I can access to master with the following commands, sudo ssh -v -A -p 2200 user@master-ip -i /root/.ssh/id_rsa

After getting into Master I want to access agents so I copied id_rsa and id_rsa.pub key from host to master node. and run the following command.

ssh -p 22 10.32.0.4 debug1: No more authentication methods to try. Permission denied (public key)

but unfortunately it will give following error, I have tried so many ways but didn't ssh into the salve.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

We can follow those steps to SSH agent:
1.Upload private key to master, I upload private key(222222) to this directory:

root@dcos-master-B9E522B-0:/home/jason/.ssh# pwd
/home/jason/.ssh
root@dcos-master-B9E522B-0:/home/jason/.ssh# ls
222222  authorized_keys  known_hosts
root@dcos-master-B9E522B-0:/home/jason/.ssh# 

2.change permission for this private key, change to 600:

jason@dcos-master-B9E522B-0:~/.ssh$ ll -a
total 20
drwx------ 2 jason jason 4096 Apr 27 02:39 ./
drwxr-xr-x 4 jason jason 4096 Apr 27 02:39 ../
-rw-rw-r-- 1 jason jason 1675 Apr 27 02:38 222222
-rw------- 1 jason jason  381 Apr 27 02:17 authorized_keys
-rw-r--r-- 1 jason jason  222 Apr 27 02:35 known_hosts
jason@dcos-master-B9E522B-0:~/.ssh$ chmod 600 222222 

3.Use this key to SSH agent:

jason@dcos-master-B9E522B-0:~/.ssh$ ssh [email protected] -i /home/jason/.ssh/222222 
ssh: /opt/mesosphere/lib/libcrypto.so.1.0.0: no version information available (required by ssh)
ssh: /opt/mesosphere/lib/libcrypto.so.1.0.0: no version information available (required by ssh)
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-28-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.



The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

jason@dcos-agent-private-B9E522B000000:~$ 

Note:
1.We can use CLI 2.0 to find the VMSS' instance admin user name, the name same as your master admin user:

C:Users>az vmss list-instances -n "dcos-agent-private-B9E522B-vmss0" -g dcos
"osProfile": {
      "adminPassword": null,
      "adminUsername": "jason",
      "computerName": "dcos-agent-private-B9E522B000000",

2.Also we should check the private key permission, we should set it to 600.
3.Make sure .ssh directory permission is 700 or 755.

drwx------ 2 jason jason 4096 Apr 27 02:39 .ssh/

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...