Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by rwniceing
at 2024-09-10 05:18:08
Point:500 Replies:5 POST_ID:829230USER_ID:12079
Topic:
Linux;;Linux Distributions
Every time, when I'm using my VPS root account on linux shell, and then
I go to other user accounts, I will type # su otherusers, and then type exit go back to
root shell after typing password again. Is there any keyword/command I can switch both root and user account without re-type su, type password ,type exit if I will do it many times and without creating too many putty remote shell so that get less error on less typing ?
Please advise
Rwiceing
I go to other user accounts, I will type # su otherusers, and then type exit go back to
root shell after typing password again. Is there any keyword/command I can switch both root and user account without re-type su, type password ,type exit if I will do it many times and without creating too many putty remote shell so that get less error on less typing ?
Please advise
Rwiceing
Author: rwniceing replied at 2024-09-14 05:12:38
Thanks for your reply
Accepted Solution
Expert: Sandy replied at 2024-09-10 07:09:54
250 points EXCELLENT
if you are on remote.. "different multiple tty console" doesn't make sense....
So.. screen command is to initialize and join the screen later .. .eg.
user1$ screen -S scr1
user1$exit
root#screen -x scr1
root# exit
so whenever you want you can initialize multiple screen with multiple users and then you can use them.
TY/SA
So.. screen command is to initialize and join the screen later .. .eg.
user1$ screen -S scr1
user1$exit
root#screen -x scr1
root# exit
so whenever you want you can initialize multiple screen with multiple users and then you can use them.
TY/SA
Author: rwniceing replied at 2024-09-10 07:06:59
Sandy, what you mean use "different multiple tty console"
Now I am using putty to remotely access my root access and user accounts on my window 7 computer
What is screen command for ?
If you provide more procedures that will be better understanding
Now I am using putty to remotely access my root access and user accounts on my window 7 computer
What is screen command for ?
If you provide more procedures that will be better understanding
Expert: Sandy replied at 2024-09-10 06:51:28
you can use different multiple tty console basically which i can consider as the simplest way. Else this is the method you are already doing is the suggested one..
One more suggestion if you can use "screen" command to get rid of it.
TY/SA
One more suggestion if you can use "screen" command to get rid of it.
TY/SA
Assisted Solution
Expert: woolmilkporc replied at 2024-09-10 06:05:54
250 points EXCELLENT
To run a command as "otheruser" from root you can simply issue
su otheruser -c command
The non-root shell will terminate once "command" has completed, so there will be no need for "exit". root will not be asked for the password of "otheruser". If you need the environment set for "otheruser" add a hyphen to the "su" command call:
su - otheruser -c command
"su [-] otheruser -c" can be set as an alias ("less typing"):
alias as_otheruser="su - otheruser -c "
as_otheruser command
will now do the trick.
Likewise, you can run commands requiring root privileges from "otheruser" by means of "sudo" and appropriate entries in the "sudoers" file. There is an option in "sudoers" to avoid being prompted for passwords.
Log in directly as "otheruser" and run root commands like this:
sudo command_on_behalf_of_root
Frequently used sudo root commands can also be aliased, of course.
You can use "sudo" to run commands on behalf of other non-root users (if so configured):
From "otheruser":
sudo -u otheruser2 command_on_behalf_of_otheruser2
Finally, sudo can be used to start an interactive shell with the privileges of root or any "otheruser". No passwords required (if so configured). "exit" is required to terminate the shell, however.
su otheruser -c command
The non-root shell will terminate once "command" has completed, so there will be no need for "exit". root will not be asked for the password of "otheruser". If you need the environment set for "otheruser" add a hyphen to the "su" command call:
su - otheruser -c command
"su [-] otheruser -c" can be set as an alias ("less typing"):
alias as_otheruser="su - otheruser -c "
as_otheruser command
will now do the trick.
Likewise, you can run commands requiring root privileges from "otheruser" by means of "sudo" and appropriate entries in the "sudoers" file. There is an option in "sudoers" to avoid being prompted for passwords.
Log in directly as "otheruser" and run root commands like this:
sudo command_on_behalf_of_root
Frequently used sudo root commands can also be aliased, of course.
You can use "sudo" to run commands on behalf of other non-root users (if so configured):
From "otheruser":
sudo -u otheruser2 command_on_behalf_of_otheruser2
Finally, sudo can be used to start an interactive shell with the privileges of root or any "otheruser". No passwords required (if so configured). "exit" is required to terminate the shell, however.