Question

What is the user centos for?

Posted September 18, 2021 99 views
CentOS

There is a user name centos created when the droplet with Centos7 is created. Anyone know what is this user about? Will anything stop working if I delete this user?
centos:x:1000:1000:Cloud User:/home/centos:/bin/bash

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @shanewjn,

Hi, yes the centos user is part of the system users. I’m not entirely sure what the user is used for but I’m positive it’s a system user.

As for the stop working part, I’m not sure. If you want to test it out, I’ll suggest creating a snapshot first and then removing the user. If you decide to do it, I’m eager to learn your output from the experiment.

  • Unless they created a new user, and gave it sudo permission, this WILL, in fact, cause issues

    @shanewjn : SSH into the server, then run the following, if you feel it is required to remove that user (which won’t hurt, if you ensure you have a different user in place):

    sudo -i
    adduser THE_NEW_USER_YOU_WANT_TO_MAKE
    <fill out the form>
    
    usermod -aG sudoers THE_NEW_USER_YOU_WANT_TO_MAKE
    

    Next, from your local machine (if it has BASH commands, like if you are using GitBASH, you are running MacOS/Linux, or WSL) open a BASH/ZSH terminal and run the following:

    ssh-copy-id THE_NEW_USER_YOU_WANT_TO_MAKE@YOUR_SERVER_IP_ADDRESS
    

    It will ask for a password. Use the one you set in the adduser command.

    Next, verify you can remote into the server with the new user:

    ssh THE_NEW_USER_YOU_WANT_TO_MAKE@YOUR_SERVER_IP_ADDRESS

    If it didn’t prompt for a password, you’re good to go.

    Finally, for cleanup:

    Set a password lock on the new user:

    while logged in to the server as the new user, ensure you have sudo permissions:

    sudo -i
    

    If that works, your prompt will change to something that starts with root

    Next, let’s remove the password on your account, as you should be set there.

    passwd -l THE_NEW_USER_YOU_WANT_TO_MAKE
    

    Next, open a new terminal, and SSH into your server as you just did:

    ssh THE_NEW_USER_YOU_WANT_TO_MAKE@YOUR_SERVER_IP_ADDRESS
    

    Now, let’s try to sudo up, and ensure there’s no issues with you having a locked password:

    sudo -i
    

    If it gives an error, stop here, and reply to me.
    If it doesn’t give an error, the next step is fairly simple:

    userdel centos
    

    Best of luck!

    • Hi @JonsJava,

      So, I read a bit more on the centos user. The default username for the CentOS 7 cloud image is centos. There is no password; instead you log in with the ssh key you provided at instance creation. You can then sudo and do whatever you like.