LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how do i sign into root with one command? (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-sign-into-root-with-one-command-248150/)

provkitir 10-27-2004 06:59 PM

how do i sign into root with one command?
 
hey all
so here's a real lazy man's question, i'm sick of typing su and then my password all the time into the console to get access, and i dont' like signin on as root, so i'm wondering, is there any brilliant oneline code that'll leme sign into root?

something like su | <the password> or something ?
i mean, it'd be nice to have a button on fluxbox menu to shutdown/reboot the computer and not the X server without havin to sign in, thanks!
:p

bluesman2333 10-27-2004 07:10 PM

"i'm sick of typing su and then my password all the time"???

You shouldn't need to do anything in root very often at all. I haven't done that for months! What are you doing that needs root permissions so often?

provkitir 10-27-2004 07:15 PM

i work with debian
the apt-get system uses root, so i install and remove --purge a lot of things with root constantly, but i don't like leavin the root window open, so yeah, plus i work with ntfs and fat partitions, i believe they require root to gain access.

provkitir 10-27-2004 07:16 PM

that, and i'm just plain lazy :-p

Bruce Hill 10-27-2004 07:23 PM

issue and read "man sudoers"

and you can change owner to users in /etc/fstab
and you can then mount those partitions as user

mcd 10-27-2004 08:01 PM

i mean honestly. i'm lazy, but that's in another category altogether! lol. i just leave one aterm open on one of my desktops, and anything that requires root access i do from there. i understand you don't want to have to do that, but it really is probably the laziest way of doing things. oh, unless there's a way to pass aterm (or whatever) a username and password like you pass it other options.

Quote:

-e command [arguments]
Run the command with its command-line arguments in the aterm window; also sets the window title and icon name to be the basename of the program being executed if neither -title (-T) nor -n are given on the command line. If this option is used, it must be the last on the command-line. If there is no -e option then the default is to run the program specified by the SHELL environment variable or, failing that, sh(1).

i just found that, so i suppose in ~/.fluxbox/menu (or wherever) you could have an entry something like this:

[exec] (aterm -- root) {aterm -tr -trsb -fg green -e su root}


i don't know if it will work, but it's worth playing around with. also, i know that aterm can be called as a login shell, or as a subshell which inherits variables/permissions from the owner...it would stand to reason that it needs to be told who the owner is, and therefore, that you can tell it who the owner is. i wish i knew how...i'll try doing more research if i have the time.

corbintechboy 10-27-2004 08:31 PM

I am behind a router and know my box pretty well. I might get flamed for this but I dont see a problem running as root under these conditions. And if one were to mess up a system under root the install process of distros today is pretty painless.

mcd 10-27-2004 09:30 PM

obviously the choice is entirely up to you. if you're comfortable with it, then who am i to criticize you for it? it's your box after all. i think it's fantastic that linux has the built-in separation of powers, but what i also think is fantastic is that linux allows you to do whatever you want with it, so if you want to run as root, more power to you. but it's not a piece of advice i would give to someone else, especially someone new to linux.

mcd 10-27-2004 09:36 PM

well, i'm at home on my linux box now, and i just tried out the -e option with aterm. it works with su, so if you type

aterm -e su

it opens an aterm, and prompts you for the root password. but i don't know how to pass it the password in the same command...possibly with some sort of i/o stream or something. i don't really know what i'm talking about though. gonna keep looking.

mcd 10-27-2004 09:45 PM

hmm, i'm reading about sudo now. stop me if you know this already, but sudo allows you to create a file that lists users and commands they are allowed to run (that normally would require root permission).

here's one page about it: http://www.siliconvalleyccie.com/linux-hn/sudo.htm

and there are lots more if you google/linux it. then you could do what you wanted in one command, after you set up the sudoers file properly.

provkitir 10-28-2004 12:12 AM

thanks a lot for the replies!!!


after addin by visudo

<user name> <server-name> = NOPASSWD: /bin/su

the lazy man dream completes :)

provkitir 10-28-2004 12:23 AM

actually in retrospect my previous post is a huge security breach...
so a better solution and still a security issue but less is the following in visudo

<user name> <server-name> = NOPASSWD: /sbin/reboot, /sbin/shutdown

thanks to all

i guess the real secure way for me to save typing my password has to be to have a finger-print test as i type sudo su into the computer, let's all wish for that in year... 2040 and may the red sox triumph many times in world series before then!

mcd 10-28-2004 07:08 PM

lol! gratz on getting it to work though ^^


All times are GMT -5. The time now is 07:56 PM.