{"id":17370,"date":"2022-06-02T05:59:28","date_gmt":"2022-06-02T05:59:28","guid":{"rendered":"https:\/\/linuxways.net\/?p=17370"},"modified":"2022-06-02T05:59:28","modified_gmt":"2022-06-02T05:59:28","slug":"how-to-switch-users-in-debian","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/how-to-switch-users-in-debian\/","title":{"rendered":"How to Switch Users in Debian"},"content":{"rendered":"<p>Debian, sometimes known as Debian GNU\/Linux, is a free and open-source Linux system developed by the Debian Project, which is supported by the community. Ian Murdock essentially started this project on August 16, 1993.<\/p>\n<p>Debian is widely regarded as one of the most popular Linux-based operating systems. Debian releases new distributions on a regular basis, with the next candidate following a time-based freeze. Whether you&#8217;re using the superuser account for administrative tasks or changing the current user&#8217;s access to a specific directory, you&#8217;ll have to move between users at some point. For coping with such issues, Linux provides a number of methods. Logging out and back in as the desired user is the apparent approach. You do, however, have a few methods for switching users without logging out of the existing one.<\/p>\n<h2>Switch users in Debian<\/h2>\n<p>In this article, we&#8217;ll discover how to switch between users in Debian in a variety of methods. These methods involve:<\/p>\n<ul>\n<li>Using su command<\/li>\n<li>Using sudo command<\/li>\n<li>Using Desktop Environment(GUI)<\/li>\n<\/ul>\n<h3>Switch User using su Command<\/h3>\n<p>You may have used the su command to elevate yourself to the level of superuser or root. This command can also be used to switch between users when another user is in the middle of a session. You can simply add the relevant username to the su command to switch to another user. here my username is \u201ctest\u201d.<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ su test<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"312\" height=\"101\" class=\"wp-image-17371\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-picture-containing-graphical-user-interface-des.png\" alt=\"A picture containing graphical user interface Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-picture-containing-graphical-user-interface-des.png 312w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-picture-containing-graphical-user-interface-des-300x97.png 300w\" sizes=\"auto, (max-width: 312px) 100vw, 312px\" \/><\/p>\n<p>The whoami command can be used to see if the user has been changed or not.<\/p>\n<p>You will be asked to enter a password if the user is password-protected or an administrator.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"365\" height=\"63\" class=\"wp-image-17372\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-picture-containing-logo-description-automatical.png\" alt=\"A picture containing logo Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-picture-containing-logo-description-automatical.png 365w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-picture-containing-logo-description-automatical-300x52.png 300w\" sizes=\"auto, (max-width: 365px) 100vw, 365px\" \/><\/p>\n<p>The su command with the -c argument can assist you run terminal commands as another user if you only need to do a quick task and don&#8217;t want to switch users.<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ su \u2013c whoami test<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"332\" height=\"73\" class=\"wp-image-17373\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/chart-scatter-chart-description-automatically-ge.png\" alt=\"Chart, scatter chart Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/chart-scatter-chart-description-automatically-ge.png 332w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/chart-scatter-chart-description-automatically-ge-300x66.png 300w\" sizes=\"auto, (max-width: 332px) 100vw, 332px\" \/><\/p>\n<p>The -s option can also be used in order to open the shell as a different user and run a series of commands. Use the following mentioned syntax in order to open the shell.<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>su &lt;username&gt; -s \/bin\/sh<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Here my username is \u201ctest\u201d, you can change the username according to your requirements.<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>su test -s \/bin\/sh<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"662\" height=\"135\" class=\"wp-image-17374\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/chart-description-automatically-generated.png\" alt=\"Chart Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/chart-description-automatically-generated.png 662w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/chart-description-automatically-generated-300x61.png 300w\" sizes=\"auto, (max-width: 662px) 100vw, 662px\" \/><\/p>\n<h3>Switch user using sudo command<\/h3>\n<p>The sudo command is another option for switching between users. To switch users, use the following below-mentioned command with the -u parameter and your username.<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo -u test<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"719\" height=\"203\" class=\"wp-image-17375\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/text-description-automatically-generated-26.png\" alt=\"Text Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/text-description-automatically-generated-26.png 719w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/text-description-automatically-generated-26-300x85.png 300w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><\/p>\n<p>With the following command, you can run a single command as a different user without having any changes in users.<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre><strong>$ sudo \u2013u test whoami<\/strong><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"355\" height=\"78\" class=\"wp-image-17376\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-picture-containing-chart-description-automatica.png\" alt=\"A picture containing chart Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-picture-containing-chart-description-automatica.png 355w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-picture-containing-chart-description-automatica-300x66.png 300w\" sizes=\"auto, (max-width: 355px) 100vw, 355px\" \/><\/p>\n<p>You can run the batch of instructions without switching users by opening a shell as another user. In order to open a shell, type the following command.<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<pre>$ sudo \u2013u test \/bin\/sh<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"674\" height=\"137\" class=\"wp-image-17377\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/chart-text-description-automatically-generated.png\" alt=\"Chart, text Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/chart-text-description-automatically-generated.png 674w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/chart-text-description-automatically-generated-300x61.png 300w\" sizes=\"auto, (max-width: 674px) 100vw, 674px\" \/><\/p>\n<h3>Switch User using Desktop Environment<\/h3>\n<p>The final and most common approach is to use your system GUI to logout or swap users. This mechanism is utilized by all multiuser operating systems and is not unique to Linux.<\/p>\n<p>If you&#8217;re utilizing a desktop environment, you&#8217;ll need to switch between users. Select the dropdown symbol from the startup menu and click on power off\/ log out option.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"343\" height=\"350\" class=\"wp-image-17378\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-screenshot-of-a-computer-description-automatica-2.png\" alt=\"A screenshot of a computer Description automatically generated with low confidence\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-screenshot-of-a-computer-description-automatica-2.png 343w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/a-screenshot-of-a-computer-description-automatica-2-294x300.png 294w\" sizes=\"auto, (max-width: 343px) 100vw, 343px\" \/><\/p>\n<p>The following session dialogue will appear when you click on logout\/ power off option.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"348\" height=\"494\" class=\"wp-image-17379\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-6.png\" alt=\"Graphical user interface, application Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-6.png 348w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-6-211x300.png 211w\" sizes=\"auto, (max-width: 348px) 100vw, 348px\" \/><\/p>\n<p>You can either select the switch user or the logout option. Both of these options will send you to the login form below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"554\" height=\"439\" class=\"wp-image-17380\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-teams-desc.png\" alt=\"Graphical user interface, application, Teams Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-teams-desc.png 554w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-teams-desc-300x238.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-teams-desc-150x120.png 150w\" sizes=\"auto, (max-width: 554px) 100vw, 554px\" \/><\/p>\n<p>Complete the login process as the user you want to log in as.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"498\" height=\"297\" class=\"wp-image-17381\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-7.png\" alt=\"Graphical user interface, application Description automatically generated\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-7.png 498w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/05\/graphical-user-interface-application-description-7-300x179.png 300w\" sizes=\"auto, (max-width: 498px) 100vw, 498px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>Most multi-user operating systems require a graphical user interface (GUI) to move between many users, Linux (Debian) allows you to log in to other user accounts using the command line. In this article, we have gone through all of the several methods you can switch between users in Linux (Debian). Advanced An understanding of the Linux command line is beneficial to any Linux user since it allows us to solve problems quickly and efficiently.<\/p>","protected":false},"excerpt":{"rendered":"<p>Debian, sometimes known as Debian GNU\/Linux, is a free and open-source Linux system developed by the Debian Project, which is supported by the community. Ian Murdock essentially started&hellip;<\/p>","protected":false},"author":1,"featured_media":17506,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[122,89],"class_list":["post-17370","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian","tag-debian-2","tag-users"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/17370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=17370"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/17370\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/17506"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=17370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=17370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=17370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}