SSH in local network [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I have about 50 computers that I need to be able to establish ssh connection. But I have to do it without typing each person's password while doing ssh-copy-id. I tried to disable password authorization in ssh but it doesn't work, still asks for a password. I know each IP but I think if there is any way to connect without a password at all? It's also acceptable if ill go to every person and ask them to enter their password on their PC. Thanks

From ssh-copy-id(1):
By default it adds the keys by appending them to the remote user's ~/.ssh/authorized_keys (creating the file, and directory, if necessary).
Since all ssh-copy-id does is copy your public key (usually ssh-keygen will create it in ~/.ssh/id_rsa.pub) to the ~/.ssh/authorized_keys file, if you want to avoid entering the 50 passwords in ssh-copy-id you just have to find a way to append your key to the 50 files. I can think of multiple methods for this:
Go physically to every machine with an thumb drive containing your pubkey and copy it by hand
Prepare an authorized_keys file, set up an anonymous ftp server (or probably any other kind of server) with the right rights and push it through there (will only work if you're certain you don't care about any data that could have been written to a preexisting file)
If you have one already setup, use a deployment tool
If each machine has a user, you could go the other way around, setup your machine with a file/web server, put you pubkey on it with a script/binary that fetches the key from the server and adds it at the bottom of the authorized_keys file and ask every user to download and execute the file
There's probably other possible methods, those seems like the easiest to me though

You can login in a remote linux by ssh without password using 'ssh-keygen' and 'ssh-copy-id':
1.- Create public and private keys using ssh-key-gen on local-host:
ssh-keygen
2.- Copy the public key to remote-host using ssh-copy-id
ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
3.- Login to remote-host without entering the password
ssh remote-host
You have more information in this documentation.

Related

Copying a local file from Mac to an ssh session in terminal [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I'm new to using bash commands and having some trouble. I'm ssh'ing into a linux box which contains some of my work files. I have a local file on my mac which I need to copy onto the server.
Here are the steps I've gone through so far:
1) ssh usrname#orgname.edu
2) Entered password
3) pwd
4) working directory: home/usrname
I'm stuck after this. I have a local folder in documents in my mac. I want to copy it to my working directory on the server I"m ssh'ed into.
Appreciate your help. Thanks
When you ssh to a remote machine, then it's as if you are sitting in front of that other machine and execute commands in it. While you are in that state, you cannot copy file to (or from) it. Instead you have to use a different tool, scp, which also belongs in the ssh family and in fact calls ssh behind the scenes. This is how you copy a local directory to a remote machine:
scp -rp /path/to/local/dir usrname#orgname.edu:/path/to/remote/dir
I used the -r mode (which stands for recursive) to copy the directory recursively. See also the manual of scp for more details
You will want to use sftpinstead of ssh for this. Try the following:
sftp usrname#orgname.edu
Enter password
cd <directory where you want to transfer the file>
put <name of file you want to transfer>
You can also add 'l' before some commands to indicate that you want to do that locally. i.e. ls will display files on the remote server, and lls will display files on the local machine.
EDIT :
You will want to make sure that you either
a. navigate to the folder that contains the file you want to transfer prior to starting the sftp process.
b. use lcd and lls once you are in the sftp session to navigate to the local folder that contains the file you want to transfer.
As mentioned in the comments, using the full path to the file you want to transfer doesn't work.
From your Linux command prompt: scp -C -r username#remote.host:/path/to/remote/directory/ target/directory

How to ssh multiple hops without putting the local RSA key everywhere [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I have a weird setup where I work from my mac, server A and server B. I can login to A directly without having password by adding my RSA keys, and login to B from A directly without using password too.
I sometimes wanted to login directly into server B from my mac, because B is where the production environment is running. I can use ssh with ProxyCommand, but then I have to add my keys into server B, is there any way I can avoid doing this? Because B is an auto managed server, the key is refreshed all the times.
Theoretically, since I can get from my mac to A (without password), and then from A to B (without password), I should be able to get into B directly. But I can't find the proper way of doing this without adding my key on mac into B's authorized_keys. Or is there a way I can automatically add my key during this login chain, because when I try to do that, ssh reports something about man-in-the-middle attack and rejects it.
Using ProxyCommand you don't need to put your key anywhere. All the authentications are initiated from your host, if you use the -W option like this:
ProxyCommand ssh -W %h:%p proxy

SSH to remote server [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
this could be a very easy question, I have read some articles but I cannot fit those articles to my situation:
I have from remote.com server a pair of private and public keys (.ppk) for user 'dummy'.
I am in some Unix server (AIX 7.1) and I want to do:
ssh dummy#remote.server with prompt the login
We don't know the password they just provided the keys to log in into the server.
What we have to do?
Just in case: We don't have puttygen and We are not allowed to install it, do we have to ask for PEM format keys?
Making some assumptions:
That the people who have given you the public/private key pair have set up the remote server "dummy" account appropriately
The version of SSH on your local UNIX server is OpenSSH (or something similar)
You need to save the private key you have been given somewhere safe on the filesystem, but this needs to be in the format the local SSH client understands - and for this you will need to run it through 'puttygen'. Does not have to be on the local server, just somewhere to get the right format of key.
ssh -i <identity-file> dummy#<servername>
should do the trick.

ssh, how to specify a key file which is on another machine? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I need to ssh to a remote host 2 when I am "sshed" in other remote machine (remote host 1). For example, from remote host1 I need to execute:
ssh -i MY_PRIVATE_KEY_FILE_NAME myname#remotehost2
However, my private key file is on my local machine. How can I specify it?
You can use ssh agent to forward your local key.
Start your agent (should be already installed) with
ssh-agent
then add your local key
ssh-add /path/to/your/keyfile.key
then login to serverA
ssh -A userA#serverA
Now you should be able to login at serverB with you local key.
Options:
scp the key to remote host 1
Copy the key manually, i.e. copy locally, open an editor on remote host 1, paste, save.
Connect to remote host 2 from a different local terminal (or drop the connection in the one you're on)
Set up ssh forwarding. I believe it would be something like ssh -R 12345:remotehost2:22 user#remotehost1, then from local ssh -p 12345 user#remotehost1. Note that user in the second command is the username for remotehost2, despite apparently connecting to 1.

Accessing a SFTP Server - are keys necessary, if yes which public or private [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
We have been given a Username and Password for a remote SFTP Server (hosted by someone else).
My SFTP Client program (that i use) asks for Keys to proceed.
What key should i ask the SFTP provider to give us - public or private?
You do not require keys in order to access a remote host using sftp. Either key-based or password-based access will work just fine, barring explicit configuration on the remote server to require one or the other.
In order to use ssh keys, you will need to first generate an ssh keypair and then place the public key in the appropriate place on the remote server. Exactly how to do this depends on what client you're using and what sort of access you have to the remote host.
In general: you would generate keys and provide the public key to the provider. It's possible that they may do it the other way (generate they keys and give you the private key), but this is less typical.

Resources