ssh - at login Passphrase for key required


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users ssh - at login Passphrase for key required
# 1  
Old 09-26-2002
Data ssh - at login Passphrase for key required

Hello,

I want to use a shell-script to transfer data over sftp.
I donīt find a way to login in automatically.
I tried to send the password in a script like possible with
ftp

sftp user@server << cmd
password
cd /distant/directory
lcd /local/directoryget ssh_install
get ( or put) your files
quit
cmd

It doesnīt work. So I tried to use a public key (Public key authentication). But now I always have to write the
passphrase - same problem again.

How is it possible to connect withput password or phrase?

Thanks!
Oliver
# 2  
Old 09-26-2002
man ssh-keygen or man ssh-keygen2 - depending upon what version of Secure Shell you are using. The ssh-keygen command generates public and private keys for a user. There is a switch on this command (usually -P) which allows for a null passphrase.

Alternatively run ssh-keygen as that user and when you are prompted to enter a passphrase simply enter a carriage return. The keys will be stored with a null passphrase.

If you exchanged the public key correctly you should now be able to copy files without being prompted for a passphrase.
# 3  
Old 09-26-2002
below is my conspect of using scp
may be auth method will help for sftp also

user mailreplicator must exist on all machines
user mailreplicator mush have valid shell (bash or so)

now you can access or use scp to any of hosts w/o pass

/usr/bin/scp -pBqC -P 2200 mailreplicator@rc.host.com:/var/qmail/control/virtualdomains .

----------------------------------
su - mailreplicator

#1) generate rsa & dsa keys
ssh-keygen -t rsa
ssh-keygen -t dsa

#2) prepare remote authorized_keys2
cat .ssh/id_rsa.pub .ssh/id_dsa.pub > .ssh/authorized_keys2
mkdir .ssh/.ssh
cp .ssh/authorized_keys2 .ssh/.ssh

#3) fix permissions
/usr/bin/find .ssh -type d -exec /bin/chmod 700 \{} \;
/usr/bin/find .ssh -type f -exec /bin/chmod 600 \{} \;

#4) propagate keys on all hosts !!! PASSWORDS are now required
scp -pvqC -P 2200 -c 3des -r .ssh/.ssh mailreplicator@rc.host.com:/usr/home/mailreplicator/.ssh
scp -pvqC -P 2200 -c 3des -r .ssh/.ssh mailreplicator@bb.host.com:/usr/home/mailreplicator/.ssh
scp -pvqC -P 2200 -c 3des -r .ssh/.ssh mailreplicator@ob.host.com:/usr/home/mailreplicator/.ssh
scp -pvqC -P 2200 -c 3des -r .ssh/.ssh mailreplicator@m1.host.com:/usr/home/mailreplicator/.ssh
scp -pvqC -P 2200 -c 3des -r .ssh/.ssh mailreplicator@h1.host.com:/usr/home/mailreplicator/.ssh
scp -pvqC -P 2200 -c 3des -r .ssh/.ssh mailreplicator@ac.host.com:/usr/home/mailreplicator/.ssh
scp -pvqC -P 2200 -c 3des -r .ssh/.ssh mailreplicator@sm.host.com:/usr/home/mailreplicator/.ssh
scp -pvqC -P 2200 -c 3des -r .ssh/.ssh mailreplicator@host.com:/usr/home/mailreplicator/.ssh
----------------------------------
HappyByte
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Ssh public/private key user login problem

I have a user account configuration with ssh public/private key that works on multiple servers centos and rhel. One server (Server F) that is not working in centos 6.8. When i ssh into server f I get prompted for a password. I have verified the config and it all is good. I put sshd into debug... (8 Replies)
Discussion started by: bash_in_my_head
8 Replies

2. Shell Programming and Scripting

Supply passphrase for ssh in script

I would like to write a bash shell script which will connect to remote server using passphrase. (I have public-private infrastructure created, and as per instruction, I must not use password less ssh). This particular script will be fired from cron. Can you please advice how I can supply the... (2 Replies)
Discussion started by: atanubanerji
2 Replies

3. AIX

ssh public key auth "Remote login for account is not allowed" ?

Hello, Using AIX 6.1 boxes. User user1 connects from box A to box B using ssh. When password authentication is used everything is fine. When I configure user1 to use public key authentication sftp client works fine(no password asked), but ssh client fails. This is sshd log: Accepted publickey... (3 Replies)
Discussion started by: vilius
3 Replies

4. OS X (Apple)

ssh passphrase issues - Mac OS X

ssh passphrase permissions issues I will try to be as thorough as possible, but keep in mind I am a designer, not a programmer... I do have linux mdadm experience and am reasonably comfortable behind the terminal, but I may need things to be spelled out for me. I am using 2 new-ish Macs with... (1 Reply)
Discussion started by: Ahab the Eskimo
1 Replies

5. UNIX for Advanced & Expert Users

ssh: require passphrase from some servers but not others

We have a number of linux clusters running Oracle. The clusters require that all member nodes have promptless/passwordless login through ssh (ie. the keys were created with null passphrases). We also have a management server that is not a member of any cluster but routinely connects to nodes of all... (3 Replies)
Discussion started by: Squeakygoose
3 Replies

6. Shell Programming and Scripting

automated ssh with provision for passphrase

Below is a part of my shell script. Currently I have shared the public key of the client with the host, therefore I will not be prompted for the password. The key that has been created on the client is also without a passphrase. If it is created with a passphrase, the code I have will not... (3 Replies)
Discussion started by: farahzaiba
3 Replies

7. Programming

Passphrase protection of private key

Hi all, I have written a Java program to generate RSA public and private keys. I am writing the keys to a file and reading from it when required to encryption or decryption. I want to protect the private key file using a passphrase. Can anyone tell me how to do it? :( Thanks. (2 Replies)
Discussion started by: Treasa
2 Replies

8. UNIX for Dummies Questions & Answers

ssh with key login - i dont get it

in my webhosts CPanel i generated keys it gives me this public key: ssh-dss... (1 Reply)
Discussion started by: scarfake
1 Replies

9. Solaris

SSH passphrase and Password

Hello all, Today we run ssh with keys on all our Solaris systems. But I wounder: Is it possible to add another authentication too. Like the os/system regular password so the users first need to enter the ssh phasssphrase and after that they need to enter the os/system password. I need like... (3 Replies)
Discussion started by: jOOc
3 Replies

10. UNIX for Advanced & Expert Users

passphrase and ssh authentication

In which case could be better don't use a passphrase creating an authentication key for ssh comunications? Thanks in advance. (1 Reply)
Discussion started by: Minguccio75
1 Replies
Login or Register to Ask a Question