LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 01-06-2012, 06:47 PM   #1
ggalan
Member
 
Registered: Oct 2010
Posts: 57

Rep: Reputation: 0
root login / add user


i have read that getting rid of root login is better for security

if so how would i add user names then give proper permission to do root things?
 
Old 01-06-2012, 06:52 PM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
Maybe it is about blocking remote login and allow only local access for root ?

Just curious, where did you read that ?
 
Old 01-06-2012, 06:55 PM   #3
ggalan
Member
 
Registered: Oct 2010
Posts: 57

Original Poster
Rep: Reputation: 0
Quote:
blocking remote login and allow only local access for root
i have to login to my server using ssh, that would make me remote, no?

http://www.howtogeek.com/howto/linux...ogin-on-linux/
 
Old 01-06-2012, 07:05 PM   #4
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
As the article says, you login via ssh as normal user and then use sudo or su to get root privileges
 
Old 01-06-2012, 07:10 PM   #5
ggalan
Member
 
Registered: Oct 2010
Posts: 57

Original Poster
Rep: Reputation: 0
like this?

root user:
Code:
service httpd stop
normal user:
Code:
sudo service httpd stop
 
Old 01-06-2012, 07:13 PM   #6
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
Exactly, it requires that you configured the /etc/sudoers file with visudo command
(which requires a little knowledge of the vi text editor functions)

Or you can just login to root, with su:

su -
password:
 
Old 01-06-2012, 07:17 PM   #7
ggalan
Member
 
Registered: Oct 2010
Posts: 57

Original Poster
Rep: Reputation: 0
Quote:
Or you can just login to root, with su:
what did you mean by this please
 
Old 01-06-2012, 08:07 PM   #8
ggalan
Member
 
Registered: Oct 2010
Posts: 57

Original Poster
Rep: Reputation: 0
now its asking me for a sudo password
dont remember ever making one, so im locked out of sudo!
what can i do???
 
Old 01-07-2012, 04:28 AM   #9
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
sudo asks for your user password

To use su, you just type: su - (and enter)
then use root password
 
Old 01-07-2012, 06:49 AM   #10
shridhar005
Member
 
Registered: Jul 2008
Posts: 90

Rep: Reputation: 17
There is an option to circumvent the password prompted by sudo command.
First login as "root", the execute visudo then you need to provide "NOPASSWD:ALL" and the end of the line for the user. Something like this:

Code:
admin      ALL=(ALL)       NOPASSWD: ALL
This will allow admin user to perform all the task with the root access without prompting the password.
This approach is not good as it makes user admin as powerful as root.

Moral of the story is to use "NOPASSWD:" prefix for the commands.

Hope this will solve the problem with the password prompt.

Next, it is always helpful to block the root user from directly log in remotely. To do so, edit the sshd configuration file, for the rpm based operating systems it is at /etc/sshd/sshd_config
Enable the
Code:
PermitRootLogin no
Do not forget to reload/restart the sshd service.
 
Old 01-07-2012, 06:57 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by shridhar005 View Post
Moral of the story is to use "NOPASSWD:" prefix for the commands.
Unless you like contradicting yourself the moral of the story is to NOT grant "NOPASSWD:" rights indiscriminately.
 
Old 01-08-2012, 06:43 PM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
unSpawn++
 
Old 01-08-2012, 10:58 PM   #13
shridhar005
Member
 
Registered: Jul 2008
Posts: 90

Rep: Reputation: 17
Quote:
admin ALL=(ALL) NOPASSWD: commands
Above is more appropriate than mentioned earlier.
 
1 members found this post helpful.
  


Reply



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
Adding root privaliges to user accounts or auto login as root Val-Ent Linux - General 15 03-02-2010 04:27 PM
Linux - How to add a new user with the same root/super-user's privileges? asgarcymed Linux - General 8 12-23-2006 07:45 PM
Gnome: Cannot login as default user, sends back to login, works as root Danny-T Linux - Newbie 2 05-27-2006 03:44 AM
Help! Cannot Add a User to User Manager or Change Root Password lennysokol Linux - General 2 06-25-2005 09:59 AM
can only login as root? user login doesnt work..? anyone? hacking_4_b33r Linux - General 1 02-05-2004 11:40 PM

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

All times are GMT -5. The time now is 02:52 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
Open Source Consulting | Domain Registration