- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- ssh sudo and stty -echo
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2005 02:04 AM
тАО02-15-2005 02:04 AM
ssh sudo and stty -echo
#!/bin/sh -xv
ssh backupserv2 stty -echo
sudo find /nsr -mtime -2 -exec ls -l {} \;
stty echo
exit
=========================================
I am running a script on one platform it does a ssh command over to another system and runs the same script which does a find command with sudo (there are files sub directories that have restrictions), but the sudo comes back and prompts for the password but when the user types in the password it is in clear text so I have been playing around with the stty -echo command I get the following error
+ echo Sudo will ask you for a passwd use your login passwd
+ [ backupserv1 = backupserv1 ]
+ stty -echo
stty: : Invalid argument
+ sudo find /nsr -mtime -7 -type f -print
Anyone know of a trick that I can hide the keying in of the password.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2005 02:08 AM
тАО02-15-2005 02:08 AM
Re: ssh sudo and stty -echo
ssh "some_host" "sudo "something" < ./abc
File abc contains the password.
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2005 03:20 AM
тАО02-15-2005 03:20 AM
Re: ssh sudo and stty -echo
I think the command "ssh backupserv2 stty -echo" (as you have it above) would execute the stty -echo command on the remote host, then drop the ssh connection, so what's the point in that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2005 03:46 AM
тАО02-15-2005 03:46 AM
Re: ssh sudo and stty -echo
First off - make a file that contains the server(s) you want to work with: /roots/bin/all.sites
Second - write a simple for loop:
for i in $(cat /roots/bin/all.sites)
do
echo $i >> /tmp/sudo.txt
ssh ${i} sudo find /nsr -mtime -2 -exec ls -l {} \; >> /tmp/sudo.txt
done
caveat: I'm not sure about the sudo command part of this loop as I just copied it from your original, but something of this order should work and you should be able to view the file /tmp/sudo.txt for problems or errors.
Hope this helps
B
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-15-2005 04:12 AM
тАО02-15-2005 04:12 AM
Re: ssh sudo and stty -echo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-03-2005 05:04 AM
тАО08-03-2005 05:04 AM