LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-23-2015, 03:44 PM   #1
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Rep: Reputation: 40
root commands without sudo?


hi group,
I get frustrated by the need for root access on common commands like:
mount
umount
gparted
apt-get
yum
etc
I currently use .alias file to provide the sudo prefix to these commands. I have my sudoers file set up with NOPASSWD.

My question is, is there an easier way other than an entry for each command in the .alias file? I get so frustrated that I often run as root which is not wise. Can I set up 'CTRL-Enter' to prefix the sudo?

Thanks for your time.
 
Old 08-23-2015, 03:56 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Even if there is a way to do this, I wouldn't suggest it, and I would suggest removing the alias as well. The need to preface a command with sudo or perform it as root is very helpful as a reminder that you can royally screw up your system if you use that tool the wrong way. That's WHY you need root permissions in order to run it in the first place. Making root-level commands easier to use without thinking about it also has the side effect of making the user less careful/responsible with those tools.

Last edited by suicidaleggroll; 08-23-2015 at 03:57 PM.
 
Old 08-23-2015, 04:04 PM   #3
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
unfortunately you are using ubuntu
there is NO root account any more so you really can not login as root
as i do with Debian8
Code:
su -
---- type in the ROOT!!!!! password when asked ----
apt-get update
apt-get upgrade
" su - " is a shortcut for " su -l root "

???
yum
???

How are you using yum on a debian bassed OS
yum is a redhat package manager



"su " and "su - " and "sudo" are the normal ways to become root
but the os has to have a root user and not the first non root user being given root power
user 500 or 1000 and not user 501 and 1001

Last edited by John VV; 08-23-2015 at 04:08 PM.
 
Old 08-23-2015, 04:09 PM   #4
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,346

Rep: Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589Reputation: 1589
I used
Code:
sudo passwd root
to set root password in Xubuntu. Then either su into root at Xterminal or alt-ctl-F1 and log in as root.

edit: The reason: with sudo, some commands permission denied.

Last edited by colorpurple21859; 08-23-2015 at 04:17 PM.
 
Old 08-23-2015, 04:47 PM   #5
Head_on_a_Stick
Senior Member
 
Registered: Dec 2014
Location: London, England
Distribution: Debian stable (and OpenBSD-current)
Posts: 1,187

Rep: Reputation: 285Reputation: 285Reputation: 285
Quote:
Originally Posted by John VV View Post
How are you using yum on a debian bassed OS
yum is a redhat package manager
https://packages.debian.org/jessie/yum

Strange but true...
 
Old 08-23-2015, 08:16 PM   #6
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,324
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
There is a root account in Ubuntu. Ubuntu hides it and gives it a random password.

colorpurple21859's suggestion should work just fine. Then you can use su to become root in a terminal, do your root stuff, then exit out of su.

Frankly, I find Ubuntu's weird sudo fetish annoying.
 
Old 08-23-2015, 08:37 PM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Even without setting a root password, "sudo -i" with your own password gives you a perfectly good interactive root shell.
 
1 members found this post helpful.
Old 08-23-2015, 10:20 PM   #8
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 18.04-14.04, Scientific Linux 6.3-6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,802

Rep: Reputation: 157Reputation: 157
It is a security problem to have an "active" root account (specifically, one that can be logged onto graphically or remotely). It's a bad idea. I had issues with it too, when first transitioning from Mandrake (yes, Mandrake, before Mandriva, or any of the multitude of financial issues that distro faced)... But, I got used to it...
 
Old 08-24-2015, 10:58 AM   #9
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by JaseP View Post
It is a security problem to have an "active" root account (specifically, one that can be logged onto graphically or remotely). It's a bad idea.
You're right, which is why Ubuntu's security policy is so ridiculous. It simply disables the real root account, and forces the first created user to become "root" instead. So now instead of having a real root account with a strong password that you can't log into graphically and can't ssh into (most distros disable root ssh access by default), you have an account that for all intents and purposes is root, yet it uses a traditionally weak user password AND it has full ssh functionality AND you log into it graphically every day. It IS a bad idea, and it's something Ubuntu forces you into with, as frankbell so elequently put it, their weird sudo fetish.

And to top it all off, if you post how to disable this asinine policy, re-enable the real root account, and strip your user of its unlimited sudo access, you'll be banned from the Ubuntu support forums. Just one of the many reasons I refuse to use Ubuntu.

Last edited by suicidaleggroll; 08-24-2015 at 11:00 AM.
 
1 members found this post helpful.
Old 08-24-2015, 11:42 AM   #10
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
You can "sudo -s" to be root for a time.

You could also "sudo passwd -d root && sudo passwd root && su"
to get a normal root in ubuntu, but I wouldn't recommend it. As I haven't a clue of how to UNDO that. And there's probably reasons why ubuntu took the effort to do what they do.

I suppose you could modify the keymap and have a key that types "sudo " when you hit it. But sudo -s is okay for me as I normally have multiple xterms open and one is basically always root. Just be mindful of physical security when operating like that. And make the root xterm unique with different color schemes and/or $PS1 attributes that are more noticeable than $ vs. #.
 
Old 08-24-2015, 12:03 PM   #11
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
"sudo -s" gives you an environment like you get from "su", while "sudo -i" gives an environment like "su -".
 
1 members found this post helpful.
Old 08-24-2015, 12:31 PM   #12
serafean
Member
 
Registered: Mar 2006
Location: Czech Republic
Distribution: Gentoo, Chakra
Posts: 997
Blog Entries: 15

Rep: Reputation: 136Reputation: 136
Quote:
Originally Posted by MrUmunhum View Post
hi group,
I get frustrated by the need for root access on common commands like:
mount
umount
gparted
apt-get
yum
etc
Hi, mount and umount could be solved by addin the 'user' option to the desired mount points in fstab.
As for running as root : you'll burn yourself quite a few times, I know I did...

S.
 
Old 08-24-2015, 03:06 PM   #13
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by Shadow_7 View Post
You can "sudo -s" to be root for a time.

You could also "sudo passwd -d root && sudo passwd root && su"
to get a normal root in ubuntu, but I wouldn't recommend it. As I haven't a clue of how to UNDO that. And there's probably reasons why ubuntu took the effort to do what they do.
As far as I know, giving root a password should make it a normal root account. I suppose to undo it, you would have to give root a password that can't be typed in.

I don't like sudo. If someone gets the user's password, they also have root access.
 
Old 08-24-2015, 03:22 PM   #14
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,264
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by replica9000 View Post
I don't like sudo. If someone gets the user's password, they also have root access.
NOT if it is PROPERLY configured and used, as opposed to being wounded and left to bleed as is done by some distros.

Last edited by astrogeek; 08-24-2015 at 03:27 PM.
 
Old 08-24-2015, 03:34 PM   #15
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Quote:
Originally Posted by replica9000 View Post
As far as I know, giving root a password should make it a normal root account. I suppose to undo it, you would have to give root a password that can't be typed in.

I don't like sudo. If someone gets the user's password, they also have root access.
You can have more than one user. And you don't have to have easy passwords on any of them. The root password is sometimes easier to guess than users passwords. Since it's likely the same across multiple machines. Plus comes with a default password in many distros and embedded firmware. And you already know that the username is root.
 
  


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
[SOLVED] How do i log all commands run by a user after elevating himself as root using sudo Arvind Shivaramakrishnan Linux - Server 2 03-11-2015 04:46 AM
[SOLVED] Running Java program as Root (sudo) - Root Commands? derekpock Programming 3 07-27-2013 11:00 AM
[SOLVED] allow normal user to exec some root commands w/o sudo gujedan Linux - Newbie 12 11-10-2011 11:16 PM
Doubt concerning keeping record of all commands executed with sudo or as root: Maragato Linux - Security 2 05-14-2011 09:06 AM
[SOLVED] Sudo does not allow access to root commands psionl0 Slackware 12 02-22-2011 03:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:50 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