“su user” does not work on CentOS 7

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have a new CentOS server.



This is server uname info:



unmae info



[root@server ~]# uname -vr
3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018
[root@server ~]#


When I try to change user using the su command, nothing happens after running the command:



su result



[root@server ~]# su ks1
[root@server ~]#


I did add my user to wheel but that didn't affect the result!



As Mentioned in Comments



[root@server ~]# getent passwd ks1
ks1:x:1004:1006::/home/ks1:/bin/false


Do you what the problem is?










share|improve this question









New contributor




Kiyarash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 2




    does the target user have a valid shell? getent passwd ksl (or ks1, I can't tell from the graphic)
    – Jeff Schaller
    1 hour ago






  • 2




    Please do not paste screenshots but rather copy text from terminal
    – mrc02_kr
    1 hour ago






  • 1




    ks1 does not have a valid shell. There shell is /bin/false @Jeff add that as an answer. You need to set there shell.
    – ctrl-alt-delor
    39 mins ago














up vote
1
down vote

favorite












I have a new CentOS server.



This is server uname info:



unmae info



[root@server ~]# uname -vr
3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018
[root@server ~]#


When I try to change user using the su command, nothing happens after running the command:



su result



[root@server ~]# su ks1
[root@server ~]#


I did add my user to wheel but that didn't affect the result!



As Mentioned in Comments



[root@server ~]# getent passwd ks1
ks1:x:1004:1006::/home/ks1:/bin/false


Do you what the problem is?










share|improve this question









New contributor




Kiyarash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 2




    does the target user have a valid shell? getent passwd ksl (or ks1, I can't tell from the graphic)
    – Jeff Schaller
    1 hour ago






  • 2




    Please do not paste screenshots but rather copy text from terminal
    – mrc02_kr
    1 hour ago






  • 1




    ks1 does not have a valid shell. There shell is /bin/false @Jeff add that as an answer. You need to set there shell.
    – ctrl-alt-delor
    39 mins ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have a new CentOS server.



This is server uname info:



unmae info



[root@server ~]# uname -vr
3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018
[root@server ~]#


When I try to change user using the su command, nothing happens after running the command:



su result



[root@server ~]# su ks1
[root@server ~]#


I did add my user to wheel but that didn't affect the result!



As Mentioned in Comments



[root@server ~]# getent passwd ks1
ks1:x:1004:1006::/home/ks1:/bin/false


Do you what the problem is?










share|improve this question









New contributor




Kiyarash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I have a new CentOS server.



This is server uname info:



unmae info



[root@server ~]# uname -vr
3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018
[root@server ~]#


When I try to change user using the su command, nothing happens after running the command:



su result



[root@server ~]# su ks1
[root@server ~]#


I did add my user to wheel but that didn't affect the result!



As Mentioned in Comments



[root@server ~]# getent passwd ks1
ks1:x:1004:1006::/home/ks1:/bin/false


Do you what the problem is?







centos su






share|improve this question









New contributor




Kiyarash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Kiyarash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 29 mins ago









Jeff Schaller

33.9k851113




33.9k851113






New contributor




Kiyarash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 1 hour ago









Kiyarash

1085




1085




New contributor




Kiyarash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Kiyarash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Kiyarash is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 2




    does the target user have a valid shell? getent passwd ksl (or ks1, I can't tell from the graphic)
    – Jeff Schaller
    1 hour ago






  • 2




    Please do not paste screenshots but rather copy text from terminal
    – mrc02_kr
    1 hour ago






  • 1




    ks1 does not have a valid shell. There shell is /bin/false @Jeff add that as an answer. You need to set there shell.
    – ctrl-alt-delor
    39 mins ago












  • 2




    does the target user have a valid shell? getent passwd ksl (or ks1, I can't tell from the graphic)
    – Jeff Schaller
    1 hour ago






  • 2




    Please do not paste screenshots but rather copy text from terminal
    – mrc02_kr
    1 hour ago






  • 1




    ks1 does not have a valid shell. There shell is /bin/false @Jeff add that as an answer. You need to set there shell.
    – ctrl-alt-delor
    39 mins ago







2




2




does the target user have a valid shell? getent passwd ksl (or ks1, I can't tell from the graphic)
– Jeff Schaller
1 hour ago




does the target user have a valid shell? getent passwd ksl (or ks1, I can't tell from the graphic)
– Jeff Schaller
1 hour ago




2




2




Please do not paste screenshots but rather copy text from terminal
– mrc02_kr
1 hour ago




Please do not paste screenshots but rather copy text from terminal
– mrc02_kr
1 hour ago




1




1




ks1 does not have a valid shell. There shell is /bin/false @Jeff add that as an answer. You need to set there shell.
– ctrl-alt-delor
39 mins ago




ks1 does not have a valid shell. There shell is /bin/false @Jeff add that as an answer. You need to set there shell.
– ctrl-alt-delor
39 mins ago










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










In order to switch user to another user, you need a shell. The shell for su is specified in the following order:



  • the shell specified with --shell

  • The shell specified in the environment variable SHELL if the --preserve-environment option is used.

  • the shell listed in the passwd entry of the target user

  • /bin/sh

Since you did not specify a --shell or --preserve-environment option, and the user had a shell listed, su executed that shell, which immediately exited.



Try, instead, setting a valid shell on the user, or specifying a shell with --shell.



su --shell /bin/bash ks1
# or
chsh -s /bin/bash ks1
su ks1





share|improve this answer




















  • That was the problem. I'm newbie, thanks for your help
    – Kiyarash
    31 mins ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Kiyarash is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475123%2fsu-user-does-not-work-on-centos-7%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










In order to switch user to another user, you need a shell. The shell for su is specified in the following order:



  • the shell specified with --shell

  • The shell specified in the environment variable SHELL if the --preserve-environment option is used.

  • the shell listed in the passwd entry of the target user

  • /bin/sh

Since you did not specify a --shell or --preserve-environment option, and the user had a shell listed, su executed that shell, which immediately exited.



Try, instead, setting a valid shell on the user, or specifying a shell with --shell.



su --shell /bin/bash ks1
# or
chsh -s /bin/bash ks1
su ks1





share|improve this answer




















  • That was the problem. I'm newbie, thanks for your help
    – Kiyarash
    31 mins ago














up vote
1
down vote



accepted










In order to switch user to another user, you need a shell. The shell for su is specified in the following order:



  • the shell specified with --shell

  • The shell specified in the environment variable SHELL if the --preserve-environment option is used.

  • the shell listed in the passwd entry of the target user

  • /bin/sh

Since you did not specify a --shell or --preserve-environment option, and the user had a shell listed, su executed that shell, which immediately exited.



Try, instead, setting a valid shell on the user, or specifying a shell with --shell.



su --shell /bin/bash ks1
# or
chsh -s /bin/bash ks1
su ks1





share|improve this answer




















  • That was the problem. I'm newbie, thanks for your help
    – Kiyarash
    31 mins ago












up vote
1
down vote



accepted







up vote
1
down vote



accepted






In order to switch user to another user, you need a shell. The shell for su is specified in the following order:



  • the shell specified with --shell

  • The shell specified in the environment variable SHELL if the --preserve-environment option is used.

  • the shell listed in the passwd entry of the target user

  • /bin/sh

Since you did not specify a --shell or --preserve-environment option, and the user had a shell listed, su executed that shell, which immediately exited.



Try, instead, setting a valid shell on the user, or specifying a shell with --shell.



su --shell /bin/bash ks1
# or
chsh -s /bin/bash ks1
su ks1





share|improve this answer












In order to switch user to another user, you need a shell. The shell for su is specified in the following order:



  • the shell specified with --shell

  • The shell specified in the environment variable SHELL if the --preserve-environment option is used.

  • the shell listed in the passwd entry of the target user

  • /bin/sh

Since you did not specify a --shell or --preserve-environment option, and the user had a shell listed, su executed that shell, which immediately exited.



Try, instead, setting a valid shell on the user, or specifying a shell with --shell.



su --shell /bin/bash ks1
# or
chsh -s /bin/bash ks1
su ks1






share|improve this answer












share|improve this answer



share|improve this answer










answered 35 mins ago









Jeff Schaller

33.9k851113




33.9k851113











  • That was the problem. I'm newbie, thanks for your help
    – Kiyarash
    31 mins ago
















  • That was the problem. I'm newbie, thanks for your help
    – Kiyarash
    31 mins ago















That was the problem. I'm newbie, thanks for your help
– Kiyarash
31 mins ago




That was the problem. I'm newbie, thanks for your help
– Kiyarash
31 mins ago










Kiyarash is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















Kiyarash is a new contributor. Be nice, and check out our Code of Conduct.












Kiyarash is a new contributor. Be nice, and check out our Code of Conduct.











Kiyarash is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475123%2fsu-user-does-not-work-on-centos-7%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)