LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Simple Shell Question Regarding Password Prompts (http://www.linuxquestions.org/questions/linux-software-2/simple-shell-question-regarding-password-prompts-534820/)

pr0gr4mm3r 03-05-2007 02:19 PM

Simple Shell Question Regarding Password Prompts
 
Is there a way to merge a shell command along with the required password onto one line? For example, I want to write a script to mount an sshfs point automatically if needed, but it always requests the password for the host. Is there a way to send the password along with the mount command? Thanks!

acid_kewpie 03-05-2007 02:24 PM

if you want to do sshfs properly, then use shared key authentication instead.

pr0gr4mm3r 03-05-2007 02:43 PM

The fist time I did it, it asked to receive an RSA Key. I accepted it, but it still asks for the password (for the host machine) to connect.

x_terminat_or_3 03-05-2007 02:44 PM

Shared Keys
 
I concur.

You should always opt for shared key authentication instead of password logins.

There are several malicious scripts out there that will try to brute force guess your SSH password. Those attacks will fail 100% of the time if you disable password logins and only allow shared key authentication.

http://kmself.home.netcom.com/Linux/FAQs/sshrsakey.html

Now a good thing by using shared keys is that you can have a key for the root account, and when you want to ssh a box while running as your user (you are running as your user aren't you!), then all you would need to do is:

su -c 'ssh box_to_connect_to'

Enter your local root password to be able to use the key, and then you will be logged on to the remote host without the need for a password.

acid_kewpie 03-05-2007 02:48 PM

Quote:

Originally Posted by pr0gr4mm3r
The fist time I did it, it asked to receive an RSA Key. I accepted it, but it still asks for the password (for the host machine) to connect.

that's not the same thing at all. check the shared guide guide in the tutorial section of this site, or indeed one of hundreds of other hits from google about rsa preshared keys


All times are GMT -5. The time now is 01:31 PM.