Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to create a new user on Linux, in way that I will not use password that asked from scp ???

For example

    scp my_new_login@ . (scp not ask about password) 

The target is to copy /home/dir/file to current directory without password, by changing login and password configuration/setup

I create the login/password by this script:

 wall "$UNAME $UPASS"
 useradd "$UNAME"
 echo "$UPASS" | passwd "$UNAME" --stdin
 usermod -g restricted "$UNAME"
share|improve this question

With SSH, you have two options to avoid typing a password when prompted:

  1. Key-based authentication
  2. Something like an expect script to type in the username/password when prompted automatically.

I highly recommend the first option over the second one.

share|improve this answer
sorry I cant use axpect , and I cant use key-based , I need other options , – Diana Nov 14 '11 at 13:24
If you want to use SCP, there aren't any other options. You could use other languages besides expect, but these two approaches are the only ones available. If you really can't use either, you'll need to use a less secure protocol for file transfer. – JakePaulus Nov 14 '11 at 13:33
so if I want to use sftp in EOF loop is it posible? – Diana Nov 14 '11 at 13:55
You can submit SFTP commands in HEREDOC format in a shell script, but SFTP (which is simply the next generation replacement for SCP) does not support inputting a password in batch mode. In this case, you cannot even use an expect script. – JakePaulus Nov 14 '11 at 14:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.