LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to enable auto login as a root (https://www.linuxquestions.org/questions/linux-software-2/how-to-enable-auto-login-as-a-root-798323/)

cimek 03-27-2010 06:19 PM

How to enable auto login as a root
 
I am using Ubuntu 10.4 beta lucid Lynx, Gnome enviroment and GDM.
I have already added root to user list and can login as ROOT when system starts but want also make it enable to auto login like any other user. I tried to make some changes in GDMSETUP but with no succes.
Can anybody help please?

dccombs 03-27-2010 06:25 PM

I'm no guru, but everything I've read over the years suggests auto-login as root is a real bad idea, and I doubt it's possible to set up the system to auto-login as root.

cimek 03-28-2010 05:40 AM

Everything's possible in the linux (maybe except "root auto log" in login options :-)).
I spent many hours googling for it and have found that this is very popular topic. Plenty of people are asking for it and some of them have found solution but usually on other distros or older versions. The problem is that those doesn'n work with new ubuntu.
I will be very grateful if somebody more familiar with unix can find it out and tell me how.

cola 03-28-2010 06:07 AM

Quote:

Originally Posted by cimek (Post 3914844)
I am using Ubuntu 10.4 beta lucid Lynx, Gnome enviroment and GDM.
I have already added root to user list and can login as ROOT when system starts but want also make it enable to auto login like any other user. I tried to make some changes in GDMSETUP but with no succes.
Can anybody help please?

http://ubuntuforums.org/showthread.php?t=528303
Does that help?

cimek 03-28-2010 12:33 PM

Thanx for a link, but not, it doesn't help.
I have found and tried it already.
This is 3 years old post and going out of topic.
There is still no "root" on the auto login list and you have to type it on start up.

PTrenholme 03-28-2010 01:12 PM

Ubuntu is a distribution intended, by in large, for Windows fugitives looking for a "similar" alternative. The Ubuntu development team has tried to avoid as many of the fundamental mistakes of the Windows family of operating systems while still providing a smooth transition.

One of the truly horrible mistakes made by Mr. Gates was to assume that Windows would always be a single-user, isolated, system. (At the time that DOS was developed, that appeared to be a reasonable assumption.) Thus the core Windows architecture made no distinction between the "administrator" and the "user." As different version of Windows were developed, they were usually designed to be backward compatible with the old DOS system, and, even though users were urged to not log in with "administrator" access, many things were difficult to accomplish without that access, so most users ignored that advice.

Thus many users of Ubuntu GNU/Linux think, quite erroneously, that they will need to log in as an administrator (i.e., as "root") to get anything done. In actual fact, unless you need to do a full system recovery from your backup system, you should never need to log in a "root." And to do that, you should boot in "recovery" mode or from a Live CD.

In contrast, GNU/Linux is built "from ground up" on a multi-user model where a normal user can do almost anything without needing "root" access. (For example, a user can compile and install their own version of almost any command without "root" access, and without impacting any other user. This makes a great testing environment since you can try your changes before releasing them for others to use.)

So, since you are new to this forum, perhaps you could tell us why you want "root" in the list of users displayed for selection in the login screen? I.e., what do you need to accomplish with a direct "root" login that you can't do as a normal user?

<edit>
To finish my thought, if you explain what you need to accomplish, perhaps we can help you do so without loggiing in as "root".
</edit>

John VV 03-28-2010 03:18 PM

1) loging in as root is not a good idea
2) auto login as root -- even worse
3) you are running Ubuntu NOT "Linux From Scratch"
4) and MOST important -- if you need to ask for help to do that( root auto login) then YOU SHOULD NOT be doing this
5) if YOU already know how to do this -- YOU WOULD NOT DO IT !!!

mark_alfred 03-28-2010 03:43 PM

For automatic root login, use Puppy Linux. See the faq where the creator addresses the question of security concerns regarding the root login issue (just scroll down to "Security concerns").

bret381 03-28-2010 06:00 PM

+1 for auto root login a very bad idea!

cimek 03-29-2010 08:01 AM

Yes I am Windows fugitive. I am using windows for almost 18 years and was happy with it until they introduce Vista. Then Windows7 had just confirmed that nothing's going better in MS family and it's high time to find some alternative.
While I am still using windows I have managed extra partition and testing linux for distro which fits best for me. I don't keep any valuable files or passwords on it, it's like a new tool, just to check if it's coming handy and I like it. All I doing on it is installing new packages, plugins, changing settings and using terminal. Everyday after I finish work I'm spending 1-2h with linux and only during this time I have to type hundred times password or sudo. It's just annoying, especially when you know that you couldn't care less about safety and every system collapse is just the reason to reinstall it which you doing every few days anyway. First thing I concidered as a helpful in my case, in new Ubuntu, was to add root to the login window and log in to it every single time.
Works fine but but at every restart you have to remember to choose other user from drop down menu, type root and then password. If you missed this moment, "restart" and typing againg. It will be even more practical for me if I can choose root, in auto login field but this is excepted from choice. I have already written to GDM makers with suggestion to add this option in their new product. It might be guarded with warnings, risk explanatory message or double confirmation request but should be allowed. It's like a "parental control" but whom against? Is there only babies using linux?
They haven't answered yet, so I'm trying to solve it on my own.
Of course when I eventually completelly move to Ubuntu I find it in my own business to establish user account and good root password, but as now I just want to get rid of it.
I am fully aware what I wanna do and I realise all the risk can follow it, so please don't send me moralizing post like "bad idea, +1, DONT DO!!!etc. Every one have freedom of choice how to use his own computer and please respect this right. I dont tend to harm anybody, maybe except myself.
If you can help anyhow then you are welcome. If not, simply don't spam this post.
Thanks everyone for help.
Mark Alfred, thanks for suggestion. I check Puppy linux as soon as I don't resolve this problem. Their arguments sounds very sensible it might be better alternative.

Hammett 03-29-2010 09:08 AM

Honestly, I do not see any reason why you should auto login as root. If you want to log in as root, fine for me. It's you pc that is at risk, but auto login is just way too much.

Andrew Benton 03-29-2010 09:21 AM

Quote:

Originally Posted by cimek (Post 3916661)
Everyday after I finish work I'm spending 1-2h with linux and only during this time I have to type hundred times password or sudo. It's just annoying, especially when you know that you couldn't care less about safety and every system collapse is just the reason to reinstall it which you doing every few days anyway.

If you don't want to have to keep using sudo, set a root password and then you can use su
Code:

sudo passwd
<enter new password>
<enter new password again>

Then when you want to do something as root in the terminal enter su then the root password you chose. Keep the terminal open and you will stay logged in as root

snowday 03-29-2010 09:23 AM

Hi Cimek, after you log into Ubuntu (as a regular user, not root!), you can open a terminal and type:

Code:

sudo -i
This will give you a root shell where you can install applications, edit configuration files, etc. without the need to "to type hundred times password or sudo".

More information here: https://wiki.ubuntu.com/RootSudo

Please respect the rights of other forum members to answer your question honestly and completely regarding the pros and cons of automatic root login, just as we respect your freedom to ask the question in the first place.

cimek 03-29-2010 11:22 AM

Tnax Snowpine. That's interesting solution.
I can use it in future but it doesn't help now, whilst I am logging in as a Root.

My intention is not to insult anyone. Ask whatever you want if it helps.
I just trying not to make this post extremely long and boring for others, with little or no help in it. I've spent lot of hours looking for working solution and know the pain.

bret381 03-29-2010 11:57 AM

Just so we're clear, this is a very bad idea, but ask and you shall recieve: http://projects.gnome.org/gdm/docs/2.18/gdm.html
This will tell you how to configure gdm. That's the best I will do for you... Read and learn, and do it if you want. Good luck

PTrenholme 03-29-2010 12:27 PM

By way of clarification, I think that, when you said you want "to enable auto login as a root," what you actually meant (from your description) what that you want root to be displayed as one of the "user" choices when the display manager request you to log in to the window manager after the boot process is finished and the X-server is started. The fundamental problem with this is, I believe (but I may be wrong), that root's "home"directory is not in /home with all the other users. Instead, root has a separate, independent, "home" directory: /root.

Anyhow, I just did this (on a Fedora 12 system using KDM, so YMMV):
Code:

$ su -
Password:
# ln -s /root /home/root
# ls /home/

Peter  root

Then I went to the login manager and root was listed as an available user (after the "exclude user" check box was unchecked).

Note, however, that I did that by starting a terminal session as "root" with the su - command, which will not work on Ubuntu unless you unlock the root login (which you said you did.).

If you can start a "root" terminal session, you can (almost) always start a window manager session for "root" by entering the command startx -- :1, which starts a second X-server on tty8 with "root" already logged in. (It also leaves your non-root session on tty7 running. You can switch between those session with <ctrl>-<alt>-<F7> and <ctrl>-<alt>-<F8> key combinations.)

Note: For session switching to work, you need a /etc/X11/xorg.conf file that contains the following stanza:
Code:

Section "ServerFlags"
        Option      "DontZap" "off"
        Option      "DontVTSwitch" "off"
        Option      "HandleSpecialKeys" "Always"
EndSection


cimek 03-30-2010 03:54 PM

Thanks PTrenholme. You are right, Ubuntu is different and even easier in this particular case. You can set up new user called ROOT with full account and it's folder directly in "User and Accounts" manager from administration panel. But even then root still doesn't appear in the login and autologin list. And is no "exclude user"check box in there.
The problem is that root has been locked somewhere in the gdmsetup preferences and is excluded from any settings. I tried to alter custom.conf on my own but it says acces is danied. Even for a root. Is anything above the ROOT? Do we have "Super Root" or God Root" in the linux?
I have sent a message to the link above (thanx bret381) and still waiting for answer.
When have any news will post it here.

Skaperen 03-30-2010 04:18 PM

Everyone seems to be saying this is a very bad idea to make root autologin. I disagree when this involves autologging in on the physical console. I do agree that casual use of the computer with all root power enabled is a bad idea. My disagreement is regarding the autologin aspect. Certainly it is a VERY VERY bad idea to have root be password-less via net access (unless your goal is to make a "honey pot" system and you should not be doing that if you need to ask how to do this here).

If someone has physical access to the computer, the can probably boot any Live CD or Live USB flash drive of their choice, and be their own root, anyway. There is little protection by requiring a login on the console. This depends on the people in the environment. If you have clueless morons wandering around typing bad commands but who cannot figure out how to get into a computer with a Live CD, then maybe not autologging will be a good thing for you.

If you think you have locked your children out of your computer via a password, and these children can get a Live CD and get to your computer when you are not around, you better rethink the situation (I've heard of someone that runs his server inside a gun safe).

I have set up autologin to root before on a few distributions. I don't have the Ubuntu variation handy. I do this on Slackware by having an entry in /etc/inittab like:
Code:

c1:12345:respawn:/sbin/agetty -n -l /etc/autologin 38400 tty1 linux
where the file /etc/autologin is a script something like what I have:
Code:

#!/bin/bash
pid="$$"
dev=$( /usr/bin/find "/proc/${pid}/fd/0" -maxdepth 0 -type l -printf '%l\n' )
tty=$( echo "${dev}" | /usr/bin/cut -d / -f 3 )
speed=$( /usr/bin/stty -a | /usr/bin/head -1 | /usr/bin/cut -d ' ' -f 2 )
if [[ -x "/etc/autologin-${tty}-OK" ]]; then
        echo ""
        echo "Welcome to `exec uname -s` `exec uname -r`."
        echo ""
        echo "`exec uname -n` login: root"
        echo "Password:"
        cd /root
        export AUTOLOGIN=1
        export AUTOLOGIN_DEV="${dev}"
        export AUTOLOGIN_TTY="${tty}"
        export AUTOLOGIN_SPEED="${speed}"
        exec /bin/su -
fi
if [[ -c "${dev}" ]]; then
        exec /sbin/agetty "${speed}" "${tty}" linux
fi
echo "Unable to enable console ${dev}"
if [[ -x /bin/sleep ]]; then
        exec /bin/sleep 3600
fi
exec /usr/bin/sleep 3600

You can customize it to suit your needs. If you system (e.g. Ubuntu) does not use /etc/inittab, you'll need to find another way to fit this in. Grep around for files that have "getty" in them as they may be what gets run, or read, to perform login startups.

If the distribution has a Live CD available, you can also pick apart the Live CD to see how it is done in there.

If you want a graphical autologin, this goes beyond my experience. See the previous paragraph.

Quakeboy02 03-30-2010 06:32 PM

What are you doing that you have to be root/sudo so often that it's an aggravation?

John VV 03-30-2010 06:50 PM

Quote:

What are you doing that you have to be root/sudo so often that it's an aggravation?
i was thinking the same

now it is nice to be able to login as root every now and then ( restoring from back-up and things like that)

nautilus - gnome and dolphin - kde can be started from the terminal as root even though you might be loged in as a normal user

installing software is for the most part the main reason ( pacman,yum,... ) or configure ,make " su " make install

reading some log files like
/var/log/errors.log and iptables.log ( need to be root )

cimek 03-31-2010 06:53 PM

Thank you Skaperen. The file you described in Ubuntu is called GETTY. You can find it in

/sbin/getty

It's quite big file, I give it more attention later because I have found something in the other place. In fact it not fulfills exactly what I expected of it, but final effect is same.
The file which keep the secret is "custom.conf" but let's start from beginning.

In the new installed and updated system log in as a ordinary user.
Open terminal and type:
[sudo passwd root
when prompt type your password
when prompted type new root password
when prompted retype new root password

Then restart and log in as a ROOT.
Open "Users and Groups" in "administration tab"
Select "root" and go to "Advanced Settings".
Tick all possible "User Privileges".
Close and go to "Login Screen" in "administration" tab.
Click unlock, type password and mark "login as" option.
It doesn't matter that root is not listed, just leave it and click "close".
Open terminal and type:

gedit /etc/gdm/custom.conf

In Gedit window change settings to:

TimedLoginEnable=false
AutomaticLoginEnable=true
TimedLogin=user
AutomaticLogin=root
TimedLoginDelay=30
DefaultSession=gnome

Then save it, close gedit, and restart system.
If everything was going fine so far you should be directly loged to the system as ROOT and not even see "login" window.
Graphic is not the issue as I have what I wanted.

It's not big thing and solution came fairly easy. By me it's no point to keep it hidden in the bottom of the system, out of reach of other users. For people like me it's saves time and nerves and should be commonly accessible for every member of community in "login window". I made some suggestions to the proper people, hopefully it will be corrected in the future updates.

Thanks everyone for every little help.

doctor_ahmed 04-27-2010 11:26 AM

How did you solve it please
i'm interesting the same gole
i searched to much to fix it
if you have solve it please help me

i'm using ubuntu 9.10 and want to autologin as root instead typing choosing it from login menu and writing password every login

John VV 04-27-2010 01:13 PM

to clarify -- this is for "doctor_ahmed"
Quote:

i'm using ubuntu 9.10 and want to autologin as root instead typing choosing it from login menu and writing password every login
read the thread
DO NOT do that "root auto login "is not a good idea

devnull10 04-27-2010 01:25 PM

I think the OP understands that it is a bad idea, but his question was not "Is it a good idea to auto login as root" it was "How to enable auto login as root".

cimek 04-27-2010 01:41 PM

There is always plenty of of obsessive people on the every forum who care about your safety more than yourself. But don't worry, I am use my system only in root mode for months and have no problems with it, so you are free to use it your way. Just follow the instructions in previous post dated 01-04-10. Create root and edit "custom.conf".
Good Luck.

doctor_ahmed 04-27-2010 03:17 PM

thanks for rapid follow up
thanks again cimek because you can understand me
that's great thing that not write password any more

i alread do it 2 minutes after i wrote the first post
I've found the method at a turkish blog

Greet cimek i have not see your method at first time
it is the same method


All times are GMT -5. The time now is 06:50 PM.