Jump to content

sudo and startx


paleo
 Share

Recommended Posts

Hi all,

 

I'm trying to figure out if it's possible to auto login into KDE without using a graphical login manager and the auto-login feature of it. Here is one thing that kind of works:

 

sudo -u {username} -H bash -l -c startx

 

if I put this is as the last line of rc.local, it will startx as the user {username}. It all seems fine except that the PATH remains that of root plus whatever other directories I specify for the user ($HOME/bin, in my case). I could get around this by modifying .bash_profile, BUT:

I was wondering if there are other things that are bad about 'logging in' a user in this way. Are there things that a user could execute with root privileges on this way of logging in?

Are there other ways of accomplishing what I want? Basically, I need a way of logging in automatically.

 

In case you're wondering: I don't like graphical login; I once had a bad experience with it as a newbie and developed a phobia; plus, booting takes longer.

Link to comment
Share on other sites

I can't find anything on the security implications of root sudoing as a normal user (I guess it's not a normal thing to do)...

 

Anyway, just found out that something simpler does it and seems safer, too:

su -l {username} -c startx

 

this way, I don't have any environmental variables around that indicate something funny. With the sudo method, some env variables clearly indicate that root is sudoing as a normal user.

 

One catch is that on this method there is no login prompt available. On ctrl-alt-F1 I can see the X startup messages, and X is running on ctrl-alt-F2. The rest is blank. I guess not too bad. I can still bail out of X and get to a prompt with ctrl-alt-backspace or ctrl-alt-F1 and then ctrl-C.

 

Edit: never mind. As they always say, rtfm. man inittab just solved things. no need to deal with rc.local.

 

Edit2: one more thing. When I do this 'auto login' thing, the who command returns an empty list. No one's logged in. Is this bad? Things seem to be working but...

Edited by paleo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...