Check whether user has passwordless setup


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check whether user has passwordless setup
# 1  
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..
# 2  
Old 09-03-2012
This User Gave Thanks to itkamaraj For This Post:
# 3  
Old 09-03-2012
nice one!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
Login or Register to Ask a Question