SSH Help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SSH Help
# 1  
Old 04-11-2009
SSH Help

SSH Help:

I have googled for SSH and had read documentation.
The best i liked is Howto Linux / UNIX setup SSH with DSA public key authentication (password less login)

But still i have few doubts:
Is ssh -i option used after the public key is setup at the remote server or can it be used with out the public private key setup?

Please explain the below command:
ssh -i /user/.ssh/id_dsa itnuvs1 "curl -stderr testing.com

Please explain the below command:
ssh -F /user/.ssh/ssh_config -o ConnectTimeout=5 $host hostname


If say suppose i have 500 servers and i need to get some data from that servers so do i need to setup public key in all servers or i can use ssh -i option.

How do i setup scp with out password authentication?

Please help
# 2  
Old 04-12-2009
The article you mention:
Tells you to chmod the .ssh folder to 755, I'm fairly sure it has to be chmodded to 700 or else SSH will not work because the .ssh directory is world readable with a chmod of 755?

The "ssh -F /user/.ssh/ssh_config" means that the ssh command should use the ssh client configuration from the file specified rather then the default file in /etc/ssh or /usr/local/etc usually.
The ConnectTimeOut=5 is self explanatory (SSH will only wait for 5 (seconds?) before giving up trying to connect)
The $host will be a variable you set to specify which host to connect to, hostname will cause an error I think and is not required.

The best way to be able to SSH to 500 hosts without passwords is to have a common NFS mounted home directory with a .ssh folder under it with a authorized_keys file in it.

Once you get passwordless SSH to work passwordless SCP will also work.

Last edited by TonyFullerMalv; 04-12-2009 at 12:19 PM..
# 3  
Old 04-12-2009
Quote:
Originally Posted by TonyFullerMalv
The article you mention:

Tells you to chmod the .ssh folder to 755, I'm fairly sure it has to be chmodded to 700 or else SSH will not work because the .ssh directory is world readable with a chmod of 755?

The "ssh -F /user/.ssh/ssh_config" means that the ssh command should use the ssh client configuration from the file specified rather then the default file in /etc/ssh or /usr/local/etc usually.
The ConnectTimeOut=5 is self explanatory (SSH will only wait for 5 (seconds?) before giving up trying to connect)
The $host will be a variable you set to specify which host to connect to, hostname will cause an error I think and is not required.

The best way to be able to SSH to 500 hosts without passwords is to have a common NFS mounted home directory with a .ssh folder under it with a authorized_keys file in it.

Once you get passwordless SSH to work passwordless SCP will also work.
Thanks TonyFullerMalv for the post.

I read documentation on internet.But none seems to give complete info.
Now i dont know what is this config file, while no tutorial on net discussed about config file.They just discussed about private and public keys

I would appreciate if any one can give a link to complete SSH setup with each and every file needed in the process.Or please point out some book
as i need to automate process to connect to 500 servers and pull some data.

Thanks
# 4  
Old 04-12-2009
Quote:
Originally Posted by TonyFullerMalv
The article you mention:

Tells you to chmod the .ssh folder to 755, I'm fairly sure it has to be chmodded to 700 or else SSH will not work because the .ssh directory is world readable with a chmod of 755?
Tha manual confirms this:
Quote:
$ man ssh
.
.
.
~/.ssh/identity
~/.ssh/id_dsa
~/.ssh/id_rsa
Contains the private key for authentication. These files con‐
tain sensitive data and should be readable by the user but not
accessible by others (read/write/execute). ssh will simply
ignore a private key file if it is accessible by others. It is
possible to specify a passphrase when generating the key which
will be used to encrypt the sensitive part of this file using
3DES.
.
.
.




Quote:
Originally Posted by zenith
Thanks TonyFullerMalv for the post.

I read documentation on internet.But none seems to give complete info.
Now i dont know what is this config file, while no tutorial on net discussed about config file.They just discussed about private and public keys

I would appreciate if any one can give a link to complete SSH setup with each and every file needed in the process.Or please point out some book
as i need to automate process to connect to 500 servers and pull some data.

Thanks
Just google for 'ssh_config', you'll find many links to explanations on what the file contains.
For your needs, though, you wouldn't need to edit ssh_config. Most default ssh_config files would work for you so long as you have your keys and permissions set correctly.

The instructions in this mini tutorial should work fine for you if you follow the instructions carefully: SSH Without a Password

If you have problems, you could use the verbose switch (-v) in order to see a verbose output and perhaps paste the errors in this thread.

eg:
Code:
# ssh -vvv user@example.org

You can use one verbose switch (-v) but using 3 v's will make your output very verbose.
# 5  
Old 04-12-2009
Take a look at :
http://www.sun.com/blueprints/0102/configssh.pdf
The settings in the ssh_config file are much the same on any Unix.

Normally you do not want to use a personal file the system one should be quite okay!

There is also the inevitable and very userful O'Reilly book on SSH, just search for SSH in the books section of Amazon.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find active SSH servers w/ ssh keys on LAN

Hi, I am trying to complete my bash script in order to find which SSH servers on LAN are still active with the ssh keys, but i am frozen at this step: #!/bin/bash # LAN SSH KEYS DISCOVERY SCRIPT </etc/passwd \ grep /bin/bash | cut -d: -f6 | sudo xargs -i -- sh -c ' && cat... (11 Replies)
Discussion started by: syrius
11 Replies

2. UNIX for Beginners Questions & Answers

Ssh script to validate ssh connection to multiple serves with status

Hi, I want to validate ssh connection one after one for multiple servers..... password less keys already setup but now i want to validate if ssh is working fine or not... I have .sh script like below and i have servers.txt contains all the list of servers #/bin/bash for host in $(cat... (3 Replies)
Discussion started by: sreeram4
3 Replies

3. Shell Programming and Scripting

Check if file exists via ssh in ssh (nested)

I'm using redhat and have an odd issue with a nested ssh call. ssh -i ~/.ssh/transfer-key -q transfer@fserver1 ] && ssh -i ~/.ssh/transfer-key transfer@fserver1 "ssh -i ~/.ssh/sftp-key sftpin@10.0.0.1 ]" && ssh -i ~/.ssh/transfer-key transfer@fserver1 "scp -i ~/.ssh/sftp-key /home/S/outbox/*... (2 Replies)
Discussion started by: say170
2 Replies

4. UNIX for Dummies Questions & Answers

SSH tunnel working for ssh but not for sshfs

I'm trying to setup a link between my home pc (work-machine) and a server at work (tar-machine) that is behind a gateway (hop-machine) and not directly accessible. my actions: work-machine$ ssh -L 1234:tar-machine:22 hop-machine work-machine$ ssh -p 1234 user@127.0.0.1 - shh access on... (1 Reply)
Discussion started by: Vathau
1 Replies

5. Shell Programming and Scripting

Ssh = ssh expect and keep everything not change include parameter postion

I have write a script which contains ssh -p 12345 dcplatform@10.125.42.50 ssh 127.0.0.1 -p 5555 "$CMD" ssh root@$GUEST_IP "$CMD" before I use public key, it works well, now I want to change to "expect", BUT I don't want to change above code and "parameter position" I can post a... (1 Reply)
Discussion started by: yanglei_fage
1 Replies

6. UNIX for Dummies Questions & Answers

SSH SSH encountered 1 errors during the transfer

This issue was resolved due to using the correct user transferring the file over to the desktop. (1 Reply)
Discussion started by: Computergal2104
1 Replies

7. Shell Programming and Scripting

Using ssh to add register key on ssh server

Hi, I want to use ssh to add a register key on remote ssh server. Since there are space characters in my register key string, it always failed. If there is no space characters in the string, it worked fine. The following is what I have tried. It seems that "ssh" command doesn't care about double... (9 Replies)
Discussion started by: leaftree
9 Replies

8. Shell Programming and Scripting

could not send commands SSH session with Net::SSH::Expect

I am using Net::SSH::Expect to connect to the device(iLO) with SSH. After the $ssh->login() I'm able to view the prompt, but not able to send any coommands. With the putty I can connect to the device and execute the commands without any issues. Here is the sample script my $ssh =... (0 Replies)
Discussion started by: hansini
0 Replies

9. Cybersecurity

What's the difference between an SSH Client and an SSH Server?

Eh... yeah. What the title says. :D (1 Reply)
Discussion started by: PSC
1 Replies
Login or Register to Ask a Question