- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Shell Script - Sending commands after "su - ergono...
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-20-2001 03:10 PM
09-20-2001 03:10 PM
Like the root user I?d like to run a command after do the following
#!/bin/ksh
su - ergonom # Ergonom is a user name
EdnStart # I?d like to run this command after do a su - ergonom
I cannot change the .profile. How can I send any kind of command after do a su - username ?
When I run my simple script the prompt change from the root user ( # ) to the user one ( $ergonom ).
The command EdnStart only runs with the user ergonom and in his home path. This command is a binary file so I don?t have access.
Somebody can help ?
Solved! Go to Solution.
- Tags:
- su
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2001 03:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2001 05:22 PM
09-20-2001 05:22 PM
Re: Shell Script - Sending commands after "su - ergonom"
Use this command
su - ergonom -c "type the full command here with the path to that command and any options/switches"
This should work.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2001 10:20 PM
09-20-2001 10:20 PM
Re: Shell Script - Sending commands after "su - ergonom"
su - user -c "command "
federico
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2001 01:04 AM
09-21-2001 01:04 AM
Re: Shell Script - Sending commands after "su - ergonom"
su - ergonom -c `. .profile;$COMMAND`
Rgds, Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2001 01:44 AM
09-21-2001 01:44 AM
Re: Shell Script - Sending commands after "su - ergonom"
Hi
If you can install (you need root access !!!)
sudo, you can configure your system to launch
commands as another user. For example, you can
configure sudo to launch "ls" as "user2" when
you are "user1".
You can find sudo at :
http://hpux.cict.fr/hppd/hpux/Sysadmin/sudo-1.6.2b1/
Regards,
Herv?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2007 10:35 AM
10-03-2007 10:35 AM
Re: Shell Script - Sending commands after "su - ergonom"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2007 04:20 AM
10-05-2007 04:20 AM
Re: Shell Script - Sending commands after "su - ergonom"
This is in the fine print of su(1):
The arguments are passed along to the new shell for execution, ...
You then have to read the shell documentation to find out what is valid.
>Tony: If you are still worried about the users .profile you could use something like the following: su - ergonom -c `. .profile;$COMMAND`
You don't need to worry about .profile since you are using "su -". And you should be using (") not (`).