Sponsored Content
Top Forums Shell Programming and Scripting Check whether user has passwordless setup Post 302695517 by ryandegreat25 on Monday 3rd of September 2012 05:09:28 AM
Old 09-03-2012
Check whether user has passwordless setup

Hello Unix scripters,

I have created a small tool that i can distribute to users to check whether they have passwordless login to a list of servers.

The problem in my code below is if user do not have the passwordless login yet, it will prompt them with a password login and my message below will never be displayed. Users then will either enter their password or just control-c which i dont want

Am i tackling the right logic and code here?

Code:
                echo "Logging in as \"${SERVERS_ID}\" to $SERVER"
                ssh  ${SERVERS_ID}@${SERVER} "exit"
                if [ "$?" -ne 0 ] ; then
                        echo "Couldn't connect to server, please verify whether server is up or your ssh passwordless login to \"${SERVERS_ID}\" is setup properly."
                else
                        echo "CONNECTED"
                fi


Last edited by ryandegreat25; 09-03-2012 at 06:16 AM..
 

10 More Discussions You Might Find Interesting

1. Solaris

user setup - only ftp access

I want to setup a user on my server and only allow that user to ftp to my server but not to be able to get to command line (telnet /ssh) I ammended my /etc/passwd so the users shell would be /usr/bin/false and this prevents log on but it also prevents the ftp.. Any ideas? (1 Reply)
Discussion started by: frustrated1
1 Replies

2. UNIX for Dummies Questions & Answers

setup of user a/c in mysql in linux

Hi Friends, I am new user of linux operating system. I wanted to install a software but facing a difficulty. I am not able to proceed to the next statement without resolving this. WFT is the software i need for my purpose. Setup a MySQL user account for WTF that will have access to ... (1 Reply)
Discussion started by: alma
1 Replies

3. Shell Programming and Scripting

How ti check if passwordless ssh is enabled between two systems

I am writing a script which will execute commands on remote host only if they have a passwordless ssh setup. How do i check for that in my script (5 Replies)
Discussion started by: vickylife
5 Replies

4. Shell Programming and Scripting

Setup multiple passwordless authentication

I have experience in setting up passwordless authentication by sharing ssh public keys manually.Currently I am in the process to the write a script to perform the same functionality from one source(host) to multiple destinations. I have one source host (Host A) whose public keys has to be shared... (9 Replies)
Discussion started by: Lancel0t
9 Replies

5. AIX

passwordless ssh for non-root user???

hi all I have a problem to set up the password ssh login for a non-root user. what I want to do is that non-root user in host A logs into host B without password prompted. what I did listed as the following steps. 1. genarate a pair of keys from host A. ssy-keygen -t rsa -N "" -f... (9 Replies)
Discussion started by: rs6000er
9 Replies

6. Shell Programming and Scripting

su -m <user> passwordless?

Hi! I am working on mac osx and have a script which prompts for password for a non-root user, can I avoid that? su -m <user> Prompts for a password. Its a startup script and the start up fails? How can I fix this? Thanks, Jack. (4 Replies)
Discussion started by: jacki
4 Replies

7. Shell Programming and Scripting

Script to check if host key authentication is setup

Hey all, I have a script that I use for some automated installs. Unfortunately for the script to work the server that it's running from needs to have host-key authentication setup to the target server. If it isn't setup beforehand and the script is executed the install partially completes and... (1 Reply)
Discussion started by: Rike255
1 Replies

8. AIX

passwordless entry using ssh from one user to a different user on the same server

Hi, We have a requirement to do passwordless entry from one user to a different user on the same AIX server using ssh keys. Can some one help me with this? Thanks in advance, Panditt (3 Replies)
Discussion started by: deshaipet
3 Replies

9. Shell Programming and Scripting

Passwordless sftp using a different user than the runtime user

I am running a shell script as user A. In that script I need to execute a sftp that would transfer the file using another user B. I am using the below command: sftp -oPort22 B@remote server However, I am getting password prompts each time. I have done the following: Added the public... (4 Replies)
Discussion started by: mady135
4 Replies

10. UNIX for Advanced & Expert Users

Passwordless ssh for different user

Hello Folks, I lost touch in ssh key gen topics. I am in need of ssh to a server without password, kindly help me in configuring. I have two servers, server1 with user name apha & server1 with user name beta. I need to ssh to the server2 from server1 with respective users, Manually i... (3 Replies)
Discussion started by: Thala
3 Replies
NWCLIENT(5)							     nwclient							       NWCLIENT(5)

NAME
nwclient - configuration file for NWClient program suite DESCRIPTION
This manual page describes the rather simple format of the file $HOME/.nwclient, the configuration file for the NWClient program suite. FILE FORMAT
The file $HOME/.nwclient consists of several lines, each describing a NWClient connection. Lines beginning with # and empty lines are ignored as comments. Because you can store passwords in .nwclient, the user programs will only scan .nwclient when only the file owner has access rights to the file. The file must be have permissions 0600. To specify a NWClient connection, the name of the file server, the user name to be used and a password is necessary. The server name and the user name are specified as SERVER/USER, and the password is separated by a blank. The password field can be omitted. In this case the user programs will ask you for a password. If you specify the password to be just a dash, then no password is used. The first valid specification has a special meaning: If the user does not name a server on the command line, the first specification is used as a 'preferred connection'. An example might be the following: # The preferred connection, the user is asked # for a password FS311/ME # And a passwordless account on another server CD-SERV/GUEST - With these lines in $HOME/.nwclient, calling 'ncpmount /mnt' will mount the the file server FS311 with user name ME on /mnt after asking the user for a password. ncpmount -S cd-serv /cd will silently mount the server cd-serv on /cd. nprint, pqlist and other user programs that require a valid login also look up $HOME/.nwclient to find a file server, a user name and pos- sibly a password. Please note that the access permissions of .nwclient MUST be 600, for security reasons. SEE ALSO
ncpmount(8), ncpumount(8), slist(1), pqlist(1), nprint(1) nwclient 12/27/1995 NWCLIENT(5)
All times are GMT -4. The time now is 09:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy