LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-04-2015, 10:34 AM   #1
dunnery
Member
 
Registered: May 2010
Location: East Stroudsburg
Distribution: Debian Jessie
Posts: 222

Rep: Reputation: 8
Setting root password


Wow, I got my new Linux pc yesterday and it's very very fast. It's faster than my new MacBook.
So I go to the user account which also says administrator so I'm presuming that's the root owner?????? and I typed in my name and changed the password. The guy who sold it to me named the password user and the computer user. Yet when I go to the terminal my username and computer is still called user@user
How do I change the root password and computer name?
 
Old 02-04-2015, 10:52 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,812
Blog Entries: 1

Rep: Reputation: 259Reputation: 259Reputation: 259
Administrator != root. Your buddy created a user named 'user' that has some sort of admin privileges. Most likely user is in the sudoers list which will allow that user to execute the sudo command.

As far as changing the password for 'user' and the hostname, you can do it from a terminal. The passwd command will change the password and you'll need to edit configuration files to change the hostname. The configuration files will vary depending on the distribution you're using. You can look at the manpage for the passwd command or use Google.

Depending on the distribution/WM/DE your buddy installed, there will/may be GUI tools to make these changes as well. If you tell us which distro and WM/DE you're using, someone can likely tell you how to use the GUI tools as well as which configuration files you need to edit to change the hostname.
 
Old 02-04-2015, 11:41 AM   #3
jwizardc
LQ Newbie
 
Registered: Jul 2004
Posts: 12

Rep: Reputation: 0
Sudo will work for you

Most everything you might want or need to do can be done from the command line using the command sudo. This is short for 'superuser do'. Because it is so easy to really futz up linux as root (the superuser), running as root is deeply frowned upon (you will get a finger sharply waved at you).
In order to do the things you can't do as a normal user (even as administrator) one prefixes the command with sudu. For example, to add a user, the command is 'useradd'. If one tries to run this command as a normal user, Linux will reply:

useradd: permission denied.
useradd: cannot lock /etc/passwd; try again later.

Performing the command with sudu allows the command to run as though the superuser ran it.

As the previous responder said, there are probably ways to do these tasks using the gui.

Real geeks use the command line.
 
Old 02-04-2015, 12:48 PM   #4
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 18 MATE, Solus 3 MATE, antiX-17, MX-16
Posts: 2,171
Blog Entries: 9

Rep: Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784
By default the root account is locked in Ubuntu for safety reasons:

https://help.ubuntu.com/community/RootSudo

As jwizardc has mentioned, the normal user uses sudo for administrative purposes.

For illustration, let's say fred is the username and lenovo is the hostname and you want to install a new package called package123.

Open Terminal.

To log in as administrator:

Code:
fred@lenovo:~$ sudo apt-get install package123
Give user password


(Not recommended for regular use, see above link)
To log in as root

Code:
fred@lenovo:~$ sudo -i
Give user password

Code:
root@lenovo:~#
...................................................................

To change hostname from lenovo to acer:

Code:
fred@lenovo:~$ gksudo gedit /etc/hostname
Give user password


Change lenovo to acer and save the file.

In addition, you need to edit the /etc/hosts file and change the 127.0.1.1 entry from lenovo to acer, then save the file.

Code:
gksudo gedit /etc/hosts
You should now have:

Code:
fred@acer:~$
...................................................................

To change user password

Code:
fred@lenovo:~$ passwd
Give user password

Code:
Changing password for fred

Enter (current) UNIX (user) password:
Enter new UNIX (user) password:
Retype new UNIX (user) password:
passwd: password updated successfully

Last edited by beachboy2; 02-06-2015 at 04:24 AM. Reason: error
 
Old 02-04-2015, 12:53 PM   #5
dunnery
Member
 
Registered: May 2010
Location: East Stroudsburg
Distribution: Debian Jessie
Posts: 222

Original Poster
Rep: Reputation: 8
I wanna be a geek

So you are saying that first I use the CLI to change the sudo password and name of the computer
and then create a new user for myself ( because the Linux police will wave a finger at me if I operate as root)
and then get rid of the user@user account.
If I do this from the CLI I will be officially a geek?
I cannot tell how excited I am.
I will have to research all the CLI commands because I'm as green as grass. Any other advice is more than welcome.
Thanks
 
Old 02-04-2015, 12:55 PM   #6
dunnery
Member
 
Registered: May 2010
Location: East Stroudsburg
Distribution: Debian Jessie
Posts: 222

Original Poster
Rep: Reputation: 8
I just saw all the CLI commands. Thank you
 
Old 02-04-2015, 01:15 PM   #7
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,812
Blog Entries: 1

Rep: Reputation: 259Reputation: 259Reputation: 259
Actually sudo stands for su "do". The su is a *nix command that stands for "substitute user". You can su (and sudo) to execute commands as any user, not just the root user. Also, sudo doesn't necessarily allow a non-root user to execute any command, it depends on how sudo is configured. So, if the configuration doesn't allow sudoers to execute the useradd command, they can't execute the command. Also, if you use sudo to execute commands as the root user, you can bork your system just as bad. You still need to understand what the command you're about to execute is going to do to the system!
 
Old 02-04-2015, 01:36 PM   #8
multiplex22
Member
 
Registered: Dec 2014
Location: ny, us
Distribution: most
Posts: 56
Blog Entries: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by dunnery View Post
So you are saying that first I use the CLI to change the sudo password and name of the computer
and then create a new user for myself ( because the Linux police will wave a finger at me if I operate as root)
and then get rid of the user@user account.
If I do this from the CLI I will be officially a geek?
I cannot tell how excited I am.
I will have to research all the CLI commands because I'm as green as grass. Any other advice is more than welcome.
Thanks
Right. You can also try "su root", then type "passwd" to set the root password. Your cli should read root@domain when you do so. Note the root user name is not easily changeable. Type passwd --help to list the commands available. Man passwd will attempt to look up any formal documentation.

sudo is a program in the /bin folder. It is suppose to aid the complex security features (pam).

As for the domain, there may be a file in the /etc folder that contains this info. You can check by searching in files using grep. Grep <pattern> <folder> -R I believe (r for recursive searching). Otherwise try a desktop application that handles system settings. You can search your repository if you have apt or a package manager.
 
Old 02-04-2015, 02:07 PM   #9
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 18 MATE, Solus 3 MATE, antiX-17, MX-16
Posts: 2,171
Blog Entries: 9

Rep: Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784
dunnery,

The reason I used fred and lenovo was to make it easier for you to see what exactly is going on since you have been lumbered with user and user:

Code:
user@user:~$
I would leave user as your username, but I would suggest changing your hostname, just to avoid confusion.

There is no need to change your user password, but then again it would give you more experience of using the command line. Give it a go!

Just use Google to search for detailed command line information.
 
Old 02-04-2015, 03:54 PM   #10
JeremyBoden
Senior Member
 
Registered: Nov 2011
Distribution: Debian
Posts: 1,195

Rep: Reputation: 243Reputation: 243Reputation: 243
If you want to know what a command does e.g. sudo, open a terminal and enter
Code:
man sudo
Press the spacebar to get subsequent pages.
 
Old 02-04-2015, 07:37 PM   #11
dunnery
Member
 
Registered: May 2010
Location: East Stroudsburg
Distribution: Debian Jessie
Posts: 222

Original Poster
Rep: Reputation: 8
in over my head

ok, sorry guys, im in over my head. I have to go back and pick up from the start.

I am dumbfounded about the user and admin/ root password thing. please bear with me.

when i first started the computer ( its an old dell refurb from ebay) the desktop came up straight away with no prompt for a password. I then went to download the updates and it asked for a password. I found out from the guy who sold it that the password was 'user'. I could access this from the user accounts from the GUI. there was only one account and it was called user. it was an administer account.

my question is... is this the sudo account, the one that can make all the serious changes, the one i shouldnt be logged in on?

the reason i ask is because i was told i had to use the CLI to access this account. I was under the impression that i had one adminitrater account with its own username and password ( that i only logged in when i needed to change something radical ) and aslo a normal user account that doesnt have access to the sudo command. (which i believe is the command that can access the system)

I am using the very latest ubuntu distro.

the info on this page is very difficult for me to grasp at this level im at. Im sure when i get to know this stuff a bit better Ill say to myself ' what an asshole' but for now I need to understand the difference between the administer account and the normal user account. im also going to post a new thread with just those words on it.
 
Old 02-04-2015, 08:11 PM   #12
JeremyBoden
Senior Member
 
Registered: Nov 2011
Distribution: Debian
Posts: 1,195

Rep: Reputation: 243Reputation: 243Reputation: 243
You have one "hidden" system account called root. You only use this to administer the deep guts of your machine.
You have a single user account called "user" with a password of user.
It's a bit unusual, but you have an auto-login to user.

You can gain temporary access to root by using the sudo mechanism.
This is basically what happened when you installed those updates.

Since a password of "user" is easily guessable, I would change the password to something a bit more difficult.
 
Old 02-05-2015, 01:15 AM   #13
beachboy2
Senior Member
 
Registered: Jan 2007
Location: Wild West Wales, UK
Distribution: Linux Mint 18 MATE, Solus 3 MATE, antiX-17, MX-16
Posts: 2,171
Blog Entries: 9

Rep: Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784Reputation: 784
dunnery,

Don't panic!

Whoever set up this computer for you did you no favours at all by choosing user for your username, your password and your hostname. It just makes things even more confusing for you.

Just forget about root for the moment and concentrate on sudo.

Jeremy has explained the situation:

Quote:
You have a single user account called "user" with a password of user.
It's a bit unusual, but you have an auto-login to user.

You can gain temporary access to root by using the sudo mechanism.
This is basically what happened when you installed those updates.
At the moment, when you open a Terminal, you should be presented with this:

Code:
user@user:~$
First of all change the hostname to dellrefurb (or whatever you prefer).

This is a fundamental change and in order to do this we must assume temporary administrative rights by means of sudo.

After the $ sign, type (or copy and paste):

Code:
gksudo gedit /etc/hostname
Press Enter.

[sudo] password for user: is displayed.

Type:

user

NB The password will not be displayed as you type for security reasons.

Press Enter.

The /etc/hostname file will contain a single word:

user

Delete user and type:

dellrefurb

Click on File. Click on Save.

You also need to edit the /etc/hosts file and change the 127.0.1.1 entry from user to dellrefurb, then save the file.

Code:
gksudo gedit /etc/hosts
Terminal should now display:

Code:
user@dellrefurb:~$
Next we change your password from user to impossibletoguess (or whatever).

After the $ sign type:

Code:
passwd
Press Enter.

Changing password for user

Enter current UNIX password:
Type user and press Enter.

Enter new UNIX password:
Type impossibletoguess and press Enter.

Retype new UNIX password:
Type impossibletoguess and press Enter.

You should then see:
passwd: password updated successfully.

Close Terminal.

So now you have a username of user, a hostname of dellrefurb and a password of impossibletoguess.

Terminal will display:

Code:
user@dellrefurb:~$
Have a close look at this link, especially the Background Information:

https://help.ubuntu.com/community/RootSudo

Quote:
my question is... is this the sudo account, the one that can make all the serious changes, the one i shouldnt be logged in on?
You must not be logged in as root, well only very rarely if the situation demands it.

As a normal user you gain temporary control of administrative rights via sudo.

If you are logged in as root then you see this in Terminal:
Code:
root@dellrefurb:~#
Note that root has replaced user and # has replaced $.

It is a steep learning curve at the beginning but the penny will drop very soon.

Last edited by beachboy2; 02-06-2015 at 04:29 AM.
 
1 members found this post helpful.
Old 02-05-2015, 06:22 PM   #14
dunnery
Member
 
Registered: May 2010
Location: East Stroudsburg
Distribution: Debian Jessie
Posts: 222

Original Poster
Rep: Reputation: 8
heres what i got

(gedit:15508): Gtk-WARNING **: Calling Inhibit failed: GDBus.Errorrg.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
 
Old 02-05-2015, 06:23 PM   #15
dunnery
Member
 
Registered: May 2010
Location: East Stroudsburg
Distribution: Debian Jessie
Posts: 222

Original Poster
Rep: Reputation: 8
(gedit:15508): Gtk-WARNING **: Calling Inhibit failed: GDBus.Errorrg.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting root password dunnery Linux - Newbie 1 02-04-2015 10:42 AM
setting root password in slackware 9 kryptozapper Linux - Newbie 9 08-12-2012 08:23 AM
How to : Find Root Password Age Setting avklinux Solaris / OpenSolaris 2 12-12-2008 02:08 PM
setting root password during install jimbrechin Ubuntu 4 05-17-2005 05:06 AM
Setting root password saxophobe Linux - Newbie 11 01-17-2004 01:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration