Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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.
I have a question on SSH...
If we do an ssh connection to a remote linux machine, it will ask for a password. Once password is entered, we will be able to login...
Ex: ssh root@<IP_Addr>
password:
So, what iam looking for is, i should be able to pass the password from the script or a single command. The user should not be asked for password.
I tried the following options....but it din't work.
You can use authentication based on a key pair. Edit the sshd config and set the password authentication to no (as shown below).
Code:
# To disable tunneled clear text passwords, change to no here!
#WimS
PasswordAuthentication no
#PasswordAuthentication yes
Next the user needs to generate a keypair.
Code:
wim@btd-techweb01:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/wim/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/wim/.ssh/id_rsa.
Your public key has been saved in /home/wim/.ssh/id_rsa.pub.
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx wim@btd-techweb01
The private key needs to be carried to the clients that need access. I copied it to a memory stick so I can access the server from 'any' location; no memory stick, no access.
If you omit the passphrase, the user will not be prompted for the passphrase.
Some other advise:
limit the users in the config; if user A does not need access, config the server so he/she can not use SSH
in general you should not use direct root access; access the server as a normal user and next su to root or use (sudo to elevate privileges). Everybody knows that there is a root user and will try to hack that account.
Last edited by Wim Sturkenboom; 11-05-2007 at 12:28 AM.
But tell me, does this Key pair work for Solaris also ? .i.e from local Linux box, i have to execute commands of remote Sun box.
Absolutely.
If you're trying to execute remote commands without going to a full shell, then you can specify the command you're trying to execute on the ssh command line -- eg:
Code:
ssh you@yourhost commandtoexecute
If you've got the same set of commands you're trying to execute on the remote system, you might consider turning them into a simple shell script. Similarly, if it's something that's going to happen at regular intervals, you may consider a cron job on the remote machine rather than having the local machine constantly poke it.
Thanks much....Looks like i can get some more ideas frm you people..
Here is what iam doing & expecting ur help on this...
See, i am doing an GUI appln in Linux using QT. We have a product which works on all the unix flavours(..Lin, Sun, Mac, HPux...)
The GUI application which am doing is bascically a testing tool which helps in testing this product.
So far what i have made is a standalone application i.e. it works only on a single Linux box. Now am working on extending this application for testing products on remote machines(Lin, Solaris, MAC) also.
So this is the actual requirement!
Few of the features of this appln are like viewing the log files, filtering the contents, viewing system properties, stop/start of product services...and some more.
-------------------------------------------------
So am assuming that, what all commands i have used to run on local machine, i can use the same commands for remote Linux machines also using - "ssh you@yourhost commandtoexecute" right? (with appropriate commands for Solaris, mac...)
I would definitely ask many questions as i progress on this..
Thanks very much in advance...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.