- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- User remove script
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
Forums
Discussions
Discussions
Discussions
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
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
09-24-2008 12:32 AM
09-24-2008 12:32 AM
I have created one user remove script which is run on one stepping stone linux server. I have my athourisation key on all the remote servers. but when i run this script it hanged. could you help me. here is the script which i have created:
#more userdel
for i in host
do
ssh $i /appl/tsu/bin/sudo userdel -r $1
done
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2008 12:48 AM
09-24-2008 12:48 AM
Re: User remove script
where do you get host variable's value from ? also if you first ssh to servers it'll ask for authenticity. you can also put #!/usr/bin/bash -x for debugging to reliase where it hangs.
Kenan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2008 02:12 AM
09-24-2008 02:12 AM
Re: User remove script
regards,
ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2008 03:08 AM
09-24-2008 03:08 AM
Re: User remove script
For this type of multiple server script the best way is to put your script into every server /home directory or other location then run your script from your master server.
for i in `cat serverlist.txt`
do
ssh $i /home/scriptname.sh
done
Suraj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2008 05:18 AM
09-24-2008 05:18 AM
SolutionFirst, it's generally a bad idea to call a script the same name as a OS binary. The reason is if your path is messed up, it will find the script before the binary. If you want to call it something close, use a capital letter or call it userrm - something along those lines.
There are a couple of possibilities of what's causing the issue.
1. Issue with the user: $1. Set the $1 variable to *something* in your script:
User=$1
I try to avoid using the positional variables, particularly in loops as they're pretty easy to stomp.
2. sudo authentication. Unless you're using NOPASSWORD option (always a bad idea), the sudo will ask for your password every 5 minutes. You can initially populate the cache by looping through the hosts and doing something like sudo ls -ld /tmp
3. If the user doesn't exist on the remote system, it may cause issues with your script. I would think it'd just display an error message..
Those are the things I'd check...
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2008 07:21 PM
09-24-2008 07:21 PM
Re: User remove script
but i have run the script in debug mode, o/p is here:
# ksh -x ./userdel user
+ ssh server /appl/tsu/bin/sudo user
after that it hanged,user exist on the server, also when i run the following cmd, it run sucessfully:
ssh server /appl/tsu/bin/sudo userdel -r user
dont know why its not running when putting on script & passing value.