Should have installed with root password

General support questions
Evergreen
Posts: 6
Joined: 2017/11/29 22:09:09

Should have installed with root password

Post by Evergreen » 2017/11/29 22:19:26

Hi,

I installed CentOS 7 recently. I just selected a user password and neglected to choose a root password which I need now. I purchased an install CD. Is it just easier if I reinstall CentOS to get a root password? Or is there a better way without reinstalling?

Also what is the best installation environment if I want to learn about command line and administration. Should I just stick with GNOME desktop for now?

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Should have installed with root password

Post by TrevorH » 2017/11/29 22:36:59

If you open a command prompt and run sudo su - (that's "sudo su minus") and give your user password when prompted, does that work? If it does then your command prompt now has a # not a $ and you are root and can change the password with the passwd command.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Evergreen
Posts: 6
Joined: 2017/11/29 22:09:09

Re: Should have installed with root password

Post by Evergreen » 2017/11/29 23:16:06

I already experimented with sudo and su last night without success. I also tried it your way just now. I pasted below. It doesn't allow me to enter user password. Black cursor just blinks. Remember, when I installed CentOS I did not choose a root password at all.

[ddegilio@localhost ~]$ sudo su -

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for ddegilio:

Evergreen
Posts: 6
Joined: 2017/11/29 22:09:09

Re: Should have installed with root password

Post by Evergreen » 2017/11/29 23:43:23

Ok. I get it now. It doesn't show you typing your password. I figured it out and was able to change the root password. Pasted below.

sudo] password for ddegilio:
[root@localhost ~]# sudo passwd
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#

Evergreen
Posts: 6
Joined: 2017/11/29 22:09:09

Re: Should have installed with root password

Post by Evergreen » 2017/11/30 01:14:59

Now that I changed the root password, what command(s) do I use in terminal to give me superuser permissions for all administrative tasks? I am the only user.

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Should have installed with root password

Post by TrevorH » 2017/11/30 01:33:06

You use sudo for everything that needs more privileges than your user has.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Evergreen
Posts: 6
Joined: 2017/11/29 22:09:09

Re: Should have installed with root password

Post by Evergreen » 2017/11/30 01:59:07

Ok. When I log in as root using su or sudo, it does not let me change permissions on one of the Nautilus files (when going through Nautilus file browser window with icons). Says I'm not the owner. Pasted root login below. Am I missing something here?

[ddegilio@localhost ~]$ su -
Password:
Last login: Wed Nov 29 18:02:26 MST 2017 on pts/0
[root@localhost ~]#

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Should have installed with root password

Post by TrevorH » 2017/11/30 07:26:55

Your terminal window is root, the rest of your GUI is still you. You'll need to use chown and/or chmod to modify the ownership/permissions on the files you want to change.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Evergreen
Posts: 6
Joined: 2017/11/29 22:09:09

Re: Should have installed with root password

Post by Evergreen » 2017/11/30 18:24:26

Thanks Trevor,

I was reading about chmod last night. When I sign in as root administrator on the log in page, I then have full access to change permissions on the GUI. But I also understand signing into root on the log-in page is frowned upon.

I also notice the only way I can close out the terminal is control C, exit, enter. Nothing else works.

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: Should have installed with root password

Post by desertcat » 2017/11/30 21:32:49

Evergreen wrote:Thanks Trevor,

I was reading about chmod last night. When I sign in as root administrator on the log in page, I then have full access to change permissions on the GUI. But I also understand signing into root on the log-in page is frowned upon.

I also notice the only way I can close out the terminal is control C, exit, enter. Nothing else works.

Yep doing anything other than administrative stuff as root is indeed frowned upon. That said there is a lot of stuff than you need to so as an admin. General rule of thumb: ALL day-to-day stuff -- surfing the net, writing letters, monitoring the machine, etc. you do as your USER; updating the machine, adding users, chown, chmod, etc. you do as ROOT. I myself like su rather than sudo -- just preference. I also modified /etc/bashrc to give me a prompt that is easy to follow: [root@leopard/home/xyz]/> or [xyz@leopard~/Downloads]/>. To EXIT /root type exit.

A great reference book to have on hand is "Linux Desk Reference" Second Edition by Scott Hawkins 2002. My copy is beat up. There are some commands that you will use over and over that you will never have to look up, and if you do there is is always "man" for the obscure parameter that you use once a year, then there is the odd command that you use infrequently like chmod or chown and then the reference book is great to have on hand. Ctrl + l is a great shortcut for clearing your screen. As you play around with various flavours of Linux the first thing you learn to do during install is to create a ROOT User as well as a General User account. Have FUN and explore.

desertcat

Post Reply