Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
and one other thing ... I create a shell script just to verify the behaviour of the script :
the connection is done .. but not the follows command
That script makes the connection to the remote server. The ls command won't run until that connection ends...so won't run remotely.
Also, you've missed the final step in Turbocapitalist's instructions:
Quote:
Then if that works, the details can be put into ~/.ssh/config
Another question: Is the user on your local machine the same as the user on the remote machine? That is, are they both marco? If so, once the keys are established and configured, you should be able to just enter
Code:
ssh lab
If they aren't the same user, then the best is what you're doing
Code:
ssh marco@lab
As has been said, you need to read and understand all the documentation.
I try to ssh the marco@xxx.xxx but the machine still ask me the password!
and in the .ssh folder there is just this file :
The SSH client configuration file would be ~/.ssh/config on your desktop or whichever machine you are connecting from
Code:
cd ~/.ssh/
ls config
First, skim through the manual page for the SSH client's configuration file.
Code:
man ssh_config
Read the description section. Pay special attention to the beginning and in particular to the later paragraphs on Host, HostName, User, IdentityFile, IdentitiesOnly, ServerAliveInterval, and ServerAliveCountMax. Then when you have an overview of those particular items, add the following to the top of configuration file. (where xxx.yyy.zz.aa is the IP address or host name for your lab machine)
Code:
Host lab xxx.yyy.zz.aa
User marco
HostName xxx.yyy.zz.aa
IdentityFile ~/.ssh/lab.ed25519.key
IdentitiesOnly yes
ServerAliveInterval 30
ServerAliveCountMax 4
That will allow you to just type either "ssh lab" or "ssh xxx.yyy.zz.aa" and connect. The SSH client will read the configuration file and fill in the pieces.
Code:
ssh lab 'ls; uname -a; lsb_release -rd; whoami;'
Setting up the configuration file for the second machine will be similar, but with the addition of the ProxyCommand configuration directive as show above in post #8.
This kind of configuration process is why there used to be IT departments and professional system administrators but those days are gone, at least for a while. Sadly the money is not freed up just used by M$ and Cisco resellers instead.
Yes, though it helps to keep the indentation. It will be easier to read once you start adding the nodes. Give it a try and see if you can do "ssh lab" now.
~ » la .ssh marco@i7-Arch
totale 20K
-rw-r--r-- 1 marco users 351 21 ott 00.03 known_hosts
-rw------- 1 marco users 411 20 ott 23.53 office.ed25519.key
-rw-r--r-- 1 marco users 98 20 ott 23.53 office.ed25519.key.pub
-rw------- 1 marco users 411 20 ott 23.59 poseidonia.ed25519.key
-rw-r--r-- 1 marco users 102 20 ott 23.59 poseidonia.ed25519.key.pub
and this from the server :
Code:
~ » la .ssh
-rw------- 1 marco marco 294 Oct 20 23:53 authorized_keys
-rw-r--r-- 1 marco marco 208 Oct 21 17:37 config
-rw-r--r-- 1 marco marco 175 Oct 20 23:37 known_hosts
-rw------- 1 marco marco 464 Oct 20 23:37 office.ed25519.key
-rw-r--r-- 1 marco marco 98 Oct 20 23:37 office.ed25519.key.pub
I'm sure that the keys are correct because I create a simple scrip :
Ok. It looks like there is no SSH client configuration file on the machine you are connecting from. You can edit ~/.ssh/config on that machine and add the items show earlier. Then give it a try:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.