Sponsored Content
Top Forums Shell Programming and Scripting Passing Password to SSH without using expect in a Script Post 302546022 by pludi on Wednesday 10th of August 2011 08:35:28 AM
Old 08-10-2011
You can't, and this isn't a bug, it's a feature to prevent anyone on the same machine from getting at your password. Using expect to circumvent this is already a very bad idea in my opinion.

If you don't want to enter a password, use public key authentication.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect Script....encrypt password and use

Could someone please help me...I have an expect script. There's a need for a log in during the script and a password is required...right now the password is just a variable in the expect script...what would be the best way to put that in an encrypted flat file and have the expect script pull the... (2 Replies)
Discussion started by: cubs0729
2 Replies

2. Shell Programming and Scripting

ssh - passing password in shell script

I have a requirement, I need to run a command at remote system using a ssh. Is there any way we can pass the username and password in shell script to the ssh command as we did it in one of the shell script for FTP. ftp -n $i <<!EOF >> user Username $PASSWD cd /home/scripts ... (5 Replies)
Discussion started by: Muktesh
5 Replies

3. Shell Programming and Scripting

SSH Login by passing password.

ssh/sftp login by passing password , is it possible.Don't want to expect. (1 Reply)
Discussion started by: dinjo_jo
1 Replies

4. Shell Programming and Scripting

Passing password in script for ssh connection - no except

Used the script posted on forum - unix.com/shell-programming-scripting/21597-script-change-passwords-same-user-multiple-servers.html but the last question posted on this seems to be still unanswered, tried different things with no success, can someone help giving an way to pass the password via... (5 Replies)
Discussion started by: sapadmin
5 Replies

5. Shell Programming and Scripting

Passing password for ssh in Script

I want to do following 2 commands via script: 1) eval `ssh-agent`2) ssh-add /export/home/sufuser/.ssh/id_rsa When asked for passphrase enter "passwordpassword1234 but whenever I run the script it stucks after "ssh-add /export/home/sufuser/.ssh/id_rsa" command and asks fro... (4 Replies)
Discussion started by: yogeshpawar
4 Replies

6. Shell Programming and Scripting

tcl/expect magic ssh dictionary password

Hi gurus, I am trying to do some expect/TCL magic. My goal is to write some kind of password guessing script (nearly similar to dictionary attack against ssh). I read that this could be possible with expect/TCL, I am newbie in this language, its function and its terms so please be patient ;) ... (3 Replies)
Discussion started by: wakatana
3 Replies

7. Shell Programming and Scripting

Passing username and password to a script running inside "expect" script

Hi I'm trying to run a script " abc.sh" which triggers "use.sh" . abc.sh is nothing but a "expect" script which provides username and password automatically to the use.sh script. Please find below the scripts: #abc.sh #!/usr/bin/expect -f exec /root/use.sh expect "*name*" send... (1 Reply)
Discussion started by: baddykam
1 Replies

8. Shell Programming and Scripting

Passing password with SSH command

Hi Experts, I have specific requirement where I want to pass the password with the ssh username@hostname command . I dont want to use RSA public and private keys also. Because that will be on production server and no one wants to give access like that. Second thing it is production... (14 Replies)
Discussion started by: sharsour
14 Replies

9. Shell Programming and Scripting

SFTP or scp with password in a batch script without using SSH keys and expect script

Dear All, I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Discussion started by: ss112233
5 Replies

10. Shell Programming and Scripting

Expect script not passing password / commands ??

Newbie here. My goal is to have the expect script log into the Ubuntu 18.04 server and run two commands (lsb_release -a and ip addr) and eventually pipe the output/results to a file. For now, I would be happy to get this one command or two to run successfully. How to fix this? #!/usr/bin/expect ... (3 Replies)
Discussion started by: jacob600
3 Replies
PASSWD(1)							  User utilities							 PASSWD(1)

NAME
passwd - update user's authentication tokens SYNOPSIS
passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [--stdin] [username] DESCRIPTION
The passwd utility is used to update user's authentication token(s). This task is achieved through calls to the Linux-PAM and Libuser API. Essentially, it initializes itself as a "passwd" service with Linux- PAM and utilizes configured password modules to authenticate and then update a user's password. A simple entry in the global Linux-PAM configuration file for this service would be: # # passwd service entry that does strength checking of # a proposed password before updating it. # passwd password requisite pam_cracklib.so retry=3 passwd password required pam_unix.so use_authtok # Note, other module types are not required for this application to function correctly. OPTIONS
-k, --keep The option -k is used to indicate that the update should only be for expired authentication tokens (passwords); the user wishes to keep their non-expired tokens as before. -l, --lock This option is used to lock the password of specified account and it is available to root only. The locking is performed by render- ing the encrypted password into an invalid string (by prefixing the encrypted string with an !). Note that the account is not fully locked - the user can still log in by other means of authentication such as the ssh public key authentication. Use chage -E 0 user command instead for full account locking. --stdin This option is used to indicate that passwd should read the new password from standard input, which can be a pipe. -u, --unlock This is the reverse of the -l option - it will unlock the account password by removing the ! prefix. This option is available to root only. By default passwd will refuse to create a passwordless account (it will not unlock an account that has only "!" as a password). The force option -f will override this protection. -d, --delete This is a quick way to delete a password for an account. It will set the named account passwordless. Available to root only. -e, --expire This is a quick way to expire a password for an account. The user will be forced to change the password during the next login attempt. Available to root only. -f, --force Force the specified operation. -n, --minimum DAYS This will set the minimum password lifetime, in days, if the user's account supports password lifetimes. Available to root only. -x, --maximum DAYS This will set the maximum password lifetime, in days, if the user's account supports password lifetimes. Available to root only. -w, --warning DAYS This will set the number of days in advance the user will begin receiving warnings that her password will expire, if the user's account supports password lifetimes. Available to root only. -i, --inactive DAYS This will set the number of days which will pass before an expired password for this account will be taken to mean that the account is inactive and should be disabled, if the user's account supports password lifetimes. Available to root only. -S, --status This will output a short information about the status of the password for a given account. Available to root user only. Remember the following two principles Protect your password. Don't write down your password - memorize it. In particular, don't write it down and leave it anywhere, and don't place it in an unencrypted file! Use unrelated passwords for systems controlled by different organizations. Don't give or share your password, in particular to someone claiming to be from computer support or a vendor. Don't let anyone watch you enter your password. Don't enter your password to a computer you don't trust or if things "look funny"; someone may be trying to hijack your password. Use the password for a limited time and change it periodically. Choose a hard-to-guess password. passwd through the calls to the pam_cracklib PAM module will try to prevent you from choosing a really bad password, but it isn't foolproof; create your password wisely. Don't use something you'd find in a dictionary (in any language or jargon). Don't use a name (including that of a spouse, parent, child, pet, fantasy character, famous person, and location) or any variation of your per- sonal or account name. Don't use accessible information about you (such as your phone number, license plate, or social security number) or your environment. Don't use a birthday or a simple pattern (such as "qwerty", "abc", or "aaa"). Don't use any of those backwards, followed by a digit, or preceded by a digit. Instead, use a mixture of upper and lower case letters, as well as digits or punctuation. When choosing a new password, make sure it's unrelated to any previous password. Use long passwords (say at least 8 characters long). You might use a word pair with punctuation inserted, a passphrase (an understandable sequence of words), or the first letter of each word in a passphrase. These principles are partially enforced by the system, but only partly so. Vigilance on your part will make the system much more secure. EXIT CODE
On successful completion of its task, passwd will complete with exit code 0. An exit code of 1 indicates an error occurred. Textual errors are written to the standard error stream. CONFORMING TO
Linux-PAM (Pluggable Authentication modules for Linux). FILES
/etc/pam.d/passwd - the Linux-PAM configuration file BUGS
None known. SEE ALSO
pam(8), pam.d(5), libuser.conf(5), and pam_chauthtok(3). For more complete information on how to configure this application with Linux-PAM, see the Linux-PAM System Administrators' Guide. AUTHOR
Cristian Gafton <gafton@redhat.com> GNU
/Linux Jun 20 2012 PASSWD(1)
All times are GMT -4. The time now is 08:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy