0

I want to create a user using useradd from root in my terminal window, after it I call passwd to set user's password.

  1. So I cant call login username because when I call it from terminal it closes terminal's window.
  2. I can write login and then write user's name but this does not work because it says that Login incorrect.
  3. I can call su user to login as new user. This command will allow me to work with new user.
  4. I can login to my new user from graphical login window (startup login window)
  5. If I write from terminal init 3, then I can write my user's name and password and login
  6. I can login as new user if my OS is running in non graphical mode.

I tested it in CentOS 5.5,6.5. I want to login as new user using login command from terminal when my OS is running in grephical mode. How can I do it?

SOLUTION: Someone adviced me to call su -l user

  • 1
    It seems to me you already listed the answer to your question as #3 in your list: "I can call su user to login as new user. This command will allow me to work with new user." – Celada Oct 7 '14 at 18:17
  • I want to login as new user using login(not su) command from terminal when my OS is running in grephical mode. This thing I need for my administrative needs. – BrettWatts Oct 7 '14 at 18:18
  • 1
    You don't want to use su yet that's exactly what su is for. You could use login as well, I suppose. I don't know what you mean by "halts my terminal" because I am able to run login from a terminal and it works just fine. – Celada Oct 7 '14 at 18:22
  • 1
    I'm not sure what your issue is. You can't have two users logged in to the GUI simultaneously. If you want to stay logged in to the GUI (yourself) and also login as the new user, and you have a problem with login, and you don't like su, then how about telneting or sshing to localhost and logging in (as the new user) that way? – G-Man Oct 7 '14 at 19:18
  • 1
    The login command works only in certain circumstances. Running in a pty opened by the window system is unfortunately not one of those circumstances. – Mark Plotnick Oct 7 '14 at 19:50
-1

It seems you just want to change the user's password. In which case you can (as root) type:

passwd user-name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.