![]() |
|
#1
|
||||
|
||||
[Linux] How to run a program under another usernamenormally I use KDE under the user 'Allowee'
but I've setup a username called 'pmsys-cvs' for my PMS Project I want to edit the scripts in KDE so I need to run my editor as 'pmsys-cvs' how am i going todo that? I guess i need to use 'sudo' for that and put 'pmsys-cvs' in my sudoers list. I always whatch out when I want todo something with permissions... |
||||
|
#2
|
||||
|
||||
|
You know this is exactly what I plan to do next... figure out CVS. I know this doesn't help you much but when you have the time, could you perhaps post a little tutorial on using CVS?
Then we can exchange notes someday... |
|
#3
|
||||
|
||||
|
Try,
su pmsys-cvs |
|
#4
|
||||
|
||||
|
Quote:
hmm, can't get that to work.... I created a shortcut and put 'pmsys-cvs' in the user box... then it prompts for my password... i've put the pmsys-cvs user in the sudoers file with 'NOPASSWD' but it still doesn't work without a password |
|
#5
|
||||
|
||||
|
First off, unless I am mistaken it is not possible to have a user without a password (I thought the password limit was at least 5 characters), but I may be mistaken.
Second a few comments on the use of su. Most of the times, you will want to call su with a -. This will bring the environment settings for this user along. Code:
Note: to su as root, no username is needed. su will always prompt for a password, unless you are root. However, running as root is not recommended. Another switch of su that I find handy is the -c switch. This will run a program/application as that user. For instance: Code:
will run the make install script as root and then return to the calling user when done. Finally, to call X applications after doing an su to another user needs some other settings. First you need to make your X server accept connections from another machine. You will need to do this even if you are making a connection as another user to the same machine. Code:
client_name can be a name or an ip address. Likely entries for a local machine can be localhost or 127.0.0.1. If you are going to do this alot, you may want to put this into a startup script, as every time that your computer is started, this needs to be redone. Finally, you need to give instructions to the client to send its output to the designated X server. I have a script file that I store under /usr/local/bin/term that does this. (/usr/local/bin is in the search path, therefore scripts stored under here can be called from anywhere.) Code:
This would be called after doing an su - with two parameters. The first being the location of the X server and the second being the name of the konsole window. Code:
This will bring up a konsole dialog shell with the caption of "name@localhost" I like to put a name on there, so I can identify these in my X session. Now if you type in an X command at this shell, ie "kwrite file", it will pull up right there. The coolest thing about all this, is that this can be done from machine to machine as well. For example, I have 3 Linux boxes at my work. I can sit at the same machine with X server and run all three of them. The processing, applications and everything are being done on the other machines, but the display is all exported to the machine at my desk. Therefore, to run a remote machine as root on my local X server, I would issue these commands from my local X server. Code:
Note, that the term script needs to be in the client machines /usr/local/bin or somewhere else in its search path. |
«
Previous Thread
|
Next Thread
»
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Linux] Finding a runaway or locked program | JdS | Computer Software Forum - Linux | 2 | 21-Jan-2004 16:00 |
| Help with calendar program | mike3340 | C++ Forum | 0 | 18-Nov-2003 21:25 |
| error during program | rjd72285 | C++ Forum | 0 | 11-Nov-2003 19:49 |
| How to write simple program like ........? | laputa9000 | C++ Forum | 3 | 29-Oct-2003 13:09 |
| one program access another? | dgoulston | C++ Forum | 1 | 07-Oct-2003 11:26 |
Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The
All times are GMT -6. The time now is 06:40.








