{"id":956,"date":"2017-12-29T04:26:23","date_gmt":"2017-12-29T04:26:23","guid":{"rendered":"https:\/\/www.newdelhihosting.co.in\/blog\/?p=956"},"modified":"2024-10-22T10:54:09","modified_gmt":"2024-10-22T10:54:09","slug":"how-to-enable-suswitch-user-in-linux-server","status":"publish","type":"post","link":"https:\/\/www.newdelhihosting.co.in\/blog\/how-to-enable-suswitch-user-in-linux-server\/","title":{"rendered":"How to enable su(switch user) in Linux server"},"content":{"rendered":"<p style=\"text-align: left;\"><strong><em>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 su<\/em><\/strong>\u00a0command is used to switch the current user to another user from SSH.If you are in the shell under your\u00a0<em>&#8220;username<\/em>&#8220;, you can change it to another user (say\u00a0<em>root<\/em>) using the\u00a0<em>su <\/em>command.This is especially used when direct root login is disabled.<\/p>\n<p><strong>Step1:Login Server:-<\/strong><\/p>\n<p>Login to server via SSH <a href=\"https:\/\/www.newdelhihosting.co.in\/blog\/how-to-vps-login-via-ssh\/\" target=\"_blank\" rel=\"noopener\">click here<\/a>\u00a0 to know how to login and change port number<\/p>\n<p><strong>Step2:User Creation:-<\/strong><\/p>\n<p>The following command will add a new user called test to your Server.<\/p>\n<pre>[root@newdelhihosting ~]# useradd test\r\n[root@newdelhihosting ~]# passwd test\r\nChanging password for user test.\r\nNew password:\r\nRetype new password:\r\npasswd: all authentication tokens updated successfully.\r\n[root@newdelhihosting ~]#<\/pre>\n<p><strong>Step3:Assign user to wheel group:-<\/strong><\/p>\n<pre>[root@newdelhihosting ~]# nano \/etc\/group\r\nwheel:x:10:test                                    \r\n<\/pre>\n<p>Save modified text and exit from group file<\/p>\n<p><a href=\"https:\/\/www.newdelhihosting.co.in\/blog\/install-and-use-nano-text-editor\/\" target=\"_blank\" rel=\"noopener\">More about<\/a> Nano Text Editor<\/p>\n<p><strong>Step4:Disable direct root access:-<\/strong><\/p>\n<pre>[root@newdelhihosting \/]# cd \/etc\/ssh\r\n[root@newdelhihosting ssh]# nano sshd_config\r\n\r\nModify \"#PermitRootLogin yes\" to \"PermitRootLogin no\"<\/pre>\n<p>Save modified text and exit from group file.<\/p>\n<p><strong>Step5:Restart the service<\/strong><\/p>\n<pre>[root@newdelhihosting ssh]# systemctl restart sshd.service\r\n[root@newdelhihosting ssh]#\r\n<\/pre>\n<p><strong>Step6:Jump to super user<\/strong><\/p>\n<pre>login as: test\r\ntest@103.14.120.207's password:enter password here\r\nGo to switch user by following command\r\n[test@newdelhihosting ~]$ su -\r\nPassword:root password\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 su\u00a0command is used to switch the current user to another user from SSH.If you are in the shell under your\u00a0&#8220;username&#8220;, you can change it to another user (say\u00a0root) using the\u00a0su command.This is especially used when direct root login is disabled. Step1:Login Server:- Login to server via SSH click here\u00a0 to know how to login&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[12],"tags":[],"class_list":["post-956","post","type-post","status-publish","format-standard","hentry","category-vps"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.newdelhihosting.co.in\/blog\/wp-json\/wp\/v2\/posts\/956"}],"collection":[{"href":"https:\/\/www.newdelhihosting.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.newdelhihosting.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.newdelhihosting.co.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.newdelhihosting.co.in\/blog\/wp-json\/wp\/v2\/comments?post=956"}],"version-history":[{"count":4,"href":"https:\/\/www.newdelhihosting.co.in\/blog\/wp-json\/wp\/v2\/posts\/956\/revisions"}],"predecessor-version":[{"id":969,"href":"https:\/\/www.newdelhihosting.co.in\/blog\/wp-json\/wp\/v2\/posts\/956\/revisions\/969"}],"wp:attachment":[{"href":"https:\/\/www.newdelhihosting.co.in\/blog\/wp-json\/wp\/v2\/media?parent=956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.newdelhihosting.co.in\/blog\/wp-json\/wp\/v2\/categories?post=956"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.newdelhihosting.co.in\/blog\/wp-json\/wp\/v2\/tags?post=956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}