ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

Unix & Linux: How to switch between users on one terminal? (9 Solutions!!)

Автор: Роэль Ван де Паар (Техническая помощь Роэля)

Загружено: 2020-08-06

Просмотров: 6464

Описание: 👉 https://amzn.to/4aLHbLD 👈 You’re literally one click away from a better setup — grab it now! 🚀👑

As an Amazon Associate I earn from qualifying purchases. Unix & Linux: How to switch between users on one terminal?


The Question: I'd like to log in as a different user without logging out of the current one
(on the same terminal). How do I do that?

Solutions: Please watch the whole video to see all solutions, in order of how many people found them helpful

== This solution helped 51 people ==
Generally you use sudo to launch a new shell as the user you want; the -u flag
lets you specify the username you want:
[mrozekma@etudes-1 ~] % whoami
mrozekma
[mrozekma@etudes-1 ~] % sudo -u nobody zsh
[nobody@etudes-1 ~] % whoami
nobody
There are more circuitous ways if you don't have sudo access, like ssh
username@localhost, but I think sudo is probably simplest if it's installed and
you have permission to use it

== This solution helped 646 people ==
How about using the su command?
$ whoami
user1
$ su - user2
Password:
$ whoami
user2
$ exit
logout
If you want to log in as root, there's no need to specify username:
$ whoami
user1
$ su -
Password:
$ whoami
root
$ exit
logout
Generally, you can use sudo to launch a new shell as the user you want; the -
u flag lets you specify the username you want:
$ whoami
user1
$ sudo -u user2 zsh
$ whoami
user2
There are more circuitous ways if you don't have sudo access, like ssh
username@localhost, but sudo is probably simplest, provided that it's installed
and you have permission to use it.

== This solution helped 28 people ==
$ whoami
This command prints the current user. To change users, we will have to use this
command (followed by the user's password):
$ su secondUser
Password:
After entering the correct password, you will be logged in as the specified
user (which you can check by rerunning whoami.

== This solution helped 9 people ==
To switch the terminal session to a different user, where that user can't exit
back into the original user, use exec:
$|# exec su - [username]
This will technically login the new user in a new term process, and close out
the current one. That way when the user attempts exit or Ctrl-D, the terminal
will close as though that user was the one who instantiated it, i.e., the user
can't exit back into the original user's term. Kind of pointless, considering
they can still just start a new terminal session and automatically be in the
original user term login, but there it is.
EDIT: For what it's worth, you can use linux vlock command in your ~/.bashrc to
lock terminal sessions by default, requiring the password of the term session
user to unlock. This would somewhat prevent the aforementioned term restart
under the original user context, given the term isn't instantiated using the
non-default ~/.bashrc of the user, as configured.

== This solution helped 18 people ==
If you're running Ubuntu, and if the user you want to login as doesn't have a
password set:
sudo su - username
Enter your own password and you should be set. Of course, this requires that
your user has rights to gain root privileges with sudo.

With thanks & praise to God, and with thanks to the many people who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music: https://www.bensound.com/royalty-free... | Images: https://stocksnap.io/license & others | With thanks to user tshepang (https://unix.stackexchange.com/users/..., user SYANiDE (https://unix.stackexchange.com/users/..., user Sundae (https://unix.stackexchange.com/users/..., user Pratt (https://unix.stackexchange.com/users/..., user Michael Mrozek (https://unix.stackexchange.com/users/73), user Maksim Luzik (https://unix.stackexchange.com/users/..., user Hopping Bunny (https://unix.stackexchange.com/users/..., user HalosGhost (https://unix.stackexchange.com/users/..., user azatar (https://unix.stackexchange.com/users/..., user Ashish Saini (https://unix.stackexchange.com/users/..., user andilabs (https://unix.stackexchange.com/users/..., and the Stack Exchange Network (http://unix.stackexchange.com/questio.... Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything is amiss at Roel D.OT VandePaar A.T gmail.com.

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Unix & Linux: How to switch between users on one terminal? (9 Solutions!!)

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

ВСЕ ЧТО НУЖНО ЗНАТЬ ПРО LINUX

ВСЕ ЧТО НУЖНО ЗНАТЬ ПРО LINUX

Как Windows работает с ОЗУ или почему вам НЕ НУЖНЫ гигабайты памяти

Как Windows работает с ОЗУ или почему вам НЕ НУЖНЫ гигабайты памяти

Как Сделать Настольный ЭЛЕКТРОЭРОЗИОННЫЙ Станок?

Как Сделать Настольный ЭЛЕКТРОЭРОЗИОННЫЙ Станок?

КАК ВСКРЫВАЮТСЯ ВСЕ СУВАЛЬДНЫЕ ЗАМКИ И КАК С ЭТИМ БОРОТЬСЯ/#медведь  +380933763773

КАК ВСКРЫВАЮТСЯ ВСЕ СУВАЛЬДНЫЕ ЗАМКИ И КАК С ЭТИМ БОРОТЬСЯ/#медведь +380933763773

How Does Linux Boot Process Work?

How Does Linux Boot Process Work?

Он не знал, Что Это был Брюс Ли — Чемпион Бросил вызов Случайному Человеку в Зале

Он не знал, Что Это был Брюс Ли — Чемпион Бросил вызов Случайному Человеку в Зале

🔥Вот и ВСЁ! У Путина КРАХ: полный КОЛЛАПС в МОСКВЕ НАЧАЛСЯ. ДАЛЬШЕ – ХУЖЕ. ШИРЯЕВ

🔥Вот и ВСЁ! У Путина КРАХ: полный КОЛЛАПС в МОСКВЕ НАЧАЛСЯ. ДАЛЬШЕ – ХУЖЕ. ШИРЯЕВ

Как Ubuntu Предала Linux - Вся Правда о Взлёте и Падении Canonical

Как Ubuntu Предала Linux - Вся Правда о Взлёте и Падении Canonical

Я полностью перешел на Linux и больше НИКОГДА не установлю Windows

Я полностью перешел на Linux и больше НИКОГДА не установлю Windows

💥 АСЛАНЯН: ТРАМП ЖЕСТКО ОБЛАЖАЛСЯ С ИРАНОМ! Тегеран СПРЯТАЛ БОМБЫ. США целились НЕ ТУДА

💥 АСЛАНЯН: ТРАМП ЖЕСТКО ОБЛАЖАЛСЯ С ИРАНОМ! Тегеран СПРЯТАЛ БОМБЫ. США целились НЕ ТУДА

Почему все ГЕРМЕТИЗИРУЮТ неправильно?

Почему все ГЕРМЕТИЗИРУЮТ неправильно?

Вы НЕ Сделаны из Атомов — Роджер Пенроуз Объясняет Настоящую Реальность

Вы НЕ Сделаны из Атомов — Роджер Пенроуз Объясняет Настоящую Реальность

.kkrieger - Инженерное Безумие Размером 96KB

.kkrieger - Инженерное Безумие Размером 96KB

Я удалил ВЕСЬ ВЕБ в Windows 11. Что из этого вышло?

Я удалил ВЕСЬ ВЕБ в Windows 11. Что из этого вышло?

Выбираем Linux для дома 🐧 За что влюбляются в Bazzite и почему бегут от Windows 11.

Выбираем Linux для дома 🐧 За что влюбляются в Bazzite и почему бегут от Windows 11.

Почему японцы до сих пор пишут иероглифами? История японской письменности

Почему японцы до сих пор пишут иероглифами? История японской письменности

Как написать картину профессионально. Мастер-класс

Как написать картину профессионально. Мастер-класс

Microsoft ломает Windows! Что происходит?

Microsoft ломает Windows! Что происходит?

Билл Гейтс В ПАНИКЕ: Windows 11 столкнулась с МИРОВЫМ отказом!

Билл Гейтс В ПАНИКЕ: Windows 11 столкнулась с МИРОВЫМ отказом!

Новый ChatGPT: от новичка до PRO за полчаса. Большой бесплатный курс

Новый ChatGPT: от новичка до PRO за полчаса. Большой бесплатный курс

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]