![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3
![]() |
Switch User
I need to switch users while performing a task, I am trying to do this with the following:
echo "pass" | sudo -u user | ls However I can't seem to escape the prompt for the password, is there a way for this prompt not show up?
__________________
Quote:
|
|
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4
![]() |
Re: Switch User
The /etc/sudoers file dictates who is allowed to sudo to what account.
When setup up correctly: sudo su - <someusername> ls exit # get out of sudo If you set up so that you or whoever is running the script can sudo then the script will run without a passwoird prompt. |
|
|
|
|
|
#3 | |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
Re: Switch User
Quote:
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Allow user to select a directory | MegaArcon | HTML / XHTML / CSS | 11 | Jun 5th, 2006 8:38 AM |
| problem with user defined class mixed with functions | willj729 | C++ | 4 | Oct 9th, 2005 3:26 PM |
| User Input for Number Format | ericelysia1 | Java | 0 | Jul 21st, 2005 3:41 PM |
| Loading and Destroying web user controls into a panel | see07 | C# | 0 | Feb 2nd, 2005 12:38 PM |
| Show web user control hidden | see07 | C# | 1 | Feb 2nd, 2005 10:35 AM |