LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-27-2008, 03:44 AM   #1
JATA01
Member
 
Registered: Nov 2007
Posts: 207

Rep: Reputation: 15
Exclamation scp needs three times password in wrong password case!!!


Hi Friends,

I need help in some script task.

While using scp it ask us for password three time.
But the main aim is to reduce the attempt of asking password only once and exit in wrong password case.

Let me know if you have more query.
Thanks.
 
Old 11-27-2008, 03:50 AM   #2
tajamari
Member
 
Registered: Jul 2007
Distribution: Red Hat CentOS Ubuntu FreeBSD OpenSuSe
Posts: 252

Rep: Reputation: 32
Quote:
Originally Posted by JATA01 View Post
Hi Friends,

I need help in some script task.

While using scp it ask us for password three time.
But the main aim is to reduce the attempt of asking password only once and exit in wrong password case.

Let me know if you have more query.
Thanks.
Set your MaxAuthTries option to 1 on /etc/ssh/sshd_config.
 
Old 11-27-2008, 03:51 AM   #3
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
'man scp' mentions at the very top: '-F ssh_config' - you need custom-made ssh_config file.
 
Old 11-27-2008, 10:38 AM   #4
JATA01
Member
 
Registered: Nov 2007
Posts: 207

Original Poster
Rep: Reputation: 15
I want to do it with script, when we will try to login with wrong password, the prompt will get exit.
Below is the script:



#!/bin/sh

echo -e "\vSTEP 1.Files Transfer.......... from Deployment Packagages\v"

#User Entering file to be transferred & User Name

read -p 'Enter the name of the file to be transferred: ' latest

read -p 'Enter Network ID: ' uname

#echo -e "\vSTEP 1.Files Transfer.......... from Deployment Packages\v"

#cd /mnt/projects/dcc_scm/DeploymentPackages

#latest=`ls -t | head -1`

scp -p /mnt/projects/dcc_scm/DeploymentPackages/$latest $uname@IP:/home//dccuser/DeploymentPackages >& result

#count=`grep -c denied result`

#if [$count -ne 0]; then

#echo -e "\v NETWORK ID OR PASSWORD IS INCORRECT\v"

#exit 1

#ps aux | grep scp

#pkill scp ; echo -e "\v NETWORK ID OR PASSWORD IS INCORRECT\v"

#fi

echo -e "\v STEP 2. Transferring Files..........from Tagged Builds\v"

#User entering file to be transferred & user name

read -p 'Enter the name of the file to be transferred: ' latest1

#cd /mnt/projects/dcc_scm/TaggedBuilds

#latest1=`ls -t | head -1`

scp /mnt/projects/dcc_scm/TaggedBuilds/$latest1 $uname@IP:/home//dccuser/DeploymentPackages


Thanks for the help!!!
 
Old 11-27-2008, 05:57 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Have a look at the Expect utility.
 
Old 11-28-2008, 03:34 PM   #6
jcookeman
Member
 
Registered: Jul 2003
Location: London, UK
Distribution: FreeBSD, OpenSuse, Ubuntu, RHEL
Posts: 417

Rep: Reputation: 33
Code:
$ scp -o NumberOfPasswordPrompts=1 file username@host:
 
Old 12-01-2008, 05:28 AM   #7
JATA01
Member
 
Registered: Nov 2007
Posts: 207

Original Poster
Rep: Reputation: 15
Thanks all, it's working perfectly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
If user enters wrong password more than 3 times sysytem gets Locked. ymr_raghu Linux - Newbie 9 09-03-2008 11:01 AM
SCP without Password help ignignokt Linux - Networking 3 01-02-2007 11:59 AM
scp, don't prompt password!! dlublink Linux - Networking 1 01-03-2005 12:54 PM
scp and no password mikeyt_333 Linux - General 2 03-26-2002 03:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration