0

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 [email protected]:/home/dir/file . (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:

 more user.sh #!/bin/sh UNAME=my_new_login UPASS=MY_PASS wall "$UNAME $UPASS" useradd "$UNAME" echo "$UPASS" | passwd "$UNAME" --stdin usermod -g restricted "$UNAME" 

1 Answer 1

1

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.

4
  • sorry I cant use axpect , and I cant use key-based , I need other options , Commented Nov 14, 2011 at 13:24
  • 1
    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. Commented Nov 14, 2011 at 13:33
  • so if I want to use sftp in EOF loop is it posible? Commented Nov 14, 2011 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. Commented Nov 14, 2011 at 14:17

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.