PDA

View Full Version : Revert to Classic Command Line Login



testingresults
2013-03-22, 19:47
There are occasions when I want to boot into Kali as quickly as possible to run a few simple tasks. So, rather than dealing with a Desktop Environment, I like the default to be simply command line and have the option to load gdm3 if needed. Here's how to do that:


QUICK METHOD

If you want a quick copy/paste method:


cp -n /etc/X11/default-display-manager{,.bkup}
echo > /etc/X11/default-display-manager
cp -n /etc/gdm3/daemon.conf{,.bkup}
sed -i 's/^.*AutomaticLoginEnable = .*/AutomaticLoginEnable = True/' /etc/gdm3/daemon.conf
sed -i 's/^.*AutomaticLogin = .*/AutomaticLogin = root/' /etc/gdm3/daemon.conf
ln -s /usr/sbin/gdm3 /usr/bin/startx # Old school ;)

Thank you, g0tmi1k (http://forums.kali.org/member.php?34-g0tmi1k)!


STEP-BY-STEP WALKTHROUGH WITH EXPLINATIONS


STEP 1: Remove our Default Display Manager.

Since we don't want any graphical defualt display, we're going to simply clear the file out completely.
First, open a terminal. Fom here, we will backup our default display manager before we clear it out:

cp /etc/X11/default-display-manager /etc/X11/default-display-manager.backup
echo "" > /etc/X11/default-display-manager


STEP 2: Set GDM3 to autologin.

Since we're forced to login to even use the command line, there is really no reason to have GDM3 prompt us to login -- in a situation where we boot up wanting the desktop environment. So, we can tell gdm3 to autologin (to an account of your choosing) when, and if, you decide to load it.


cp /etc/gdm3/daemon.conf /etc/gdm3/daemon.conf.backup
leafpad /etc/gdm3/daemon.conf

Now, under section "[daemon]" we want to change both AutomaticLoginEnable and AutomaticLogin lines


[daemon]
# Enabling automatic login
# AutomaticLoginEnable = true
# AutomaticLogin = user1

Should now look like:


[daemon]
# Enabling automatic login
AutomaticLoginEnable = true
AutomaticLogin = root


NOTES

Now, whenever you boot into Kali, you'll be prompted to login at the command line, rather than the gdm3 GUI. Once logged in, you can always startup your desktop environment by simply typing in

gdm3


(optional) STEP 3: Use the the classic 'startx' command to run GNOME.
Thanks to user wlan0 (http://forums.kali.org/member.php?1266-wlan0) for the suggestion ;)


Simply open a terminal and type the following:

ln -s /usr/sbin/gdm3 /usr/sbin/startx
Now, rather than using gdm3 to start gnome, you'd use 'startx'.

wlan0
2013-03-23, 14:06
cp /usr/bin/gdm3 /usr/bin/startx
You can command startx . Like backtrack :)

jerichodotm
2013-03-23, 16:37
I'm not being wise *** here at all, but why not just boot into run level 3 then when you want to go into the GUI change to 5?

Thx

testingresults
2013-03-25, 23:07
I'm not being wise *** here at all, but why not just boot into run level 3 then when you want to go into the GUI change to 5?

Thx


Have you actually checked the runlevels on the default build of Kali?

I haven't changed mine, but after quickly glancing at the relevant directories, I don't believe this would accomplish the same thing.

superkojiman
2013-03-25, 23:33
Alternatively, you can also apt-get install sysv-rc-conf, run it, and uncheck gdm.

testingresults
2013-03-27, 17:30
You can command startx . Like backtrack :)

It's acutally located in /usr/sbin, but I actually did this after reading your comment. ;)

Typing startx is more natural to me. Plus, it can be done using only one hand!

testingresults
2013-03-28, 00:35
Alternatively, you can also apt-get install sysv-rc-conf, run it, and uncheck gdm.

Doing this will still require you to login twice on the occasions you decide to use gnome.

Neither "alternative" suggested in this thread accomplishes the same thing.

Hitman
2013-03-29, 19:52
this way you have to give usename and password twice. Once in command line and second time when you start gdm3. i want the same way like BT R3 login via command line and startx....... game on..... :cool: anybody knows how to??????

testingresults
2013-03-30, 04:09
this way you have to give usename and password twice. Once in command line and second time when you start gdm3. i want the same way like BT R3 login via command line and startx....... game on..... :cool: anybody knows how to??????

Do it the way I have it in the the initial post. If you edit the daemon as shown in Step 2, you'll only have to login once. I've added the additional, optional Step 3 to use classic startx to run gnome.

Hitman
2013-04-01, 06:12
Do it the way I have it in the the initial post. If you edit the daemon as shown in Step 2, you'll only have to login once. I've added the additional, optional Step 3 to use classic startx to run gnome.

Man my /etc/gdm3/daemon.conf file already (default) having this code
[daemon]
# Enabling automatic login
AutomaticLoginEnable = true
AutomaticLogin = root

now what to change in it its already the same that you described. I have to login twice one time in terminal and one time graphical do you have any other solution for it???

Hitman
2013-04-05, 18:14
ooopss :rolleyes: sorry guys i forgot to remove the # in the begining its working 100% ;)

torque
2013-04-05, 19:24
Thanks for the write up. It works great, I like going into the text mode like BT. Noob question but how do you leave the gui back into text mode without shutting down? I didn't create the symbolic link so I use gdm3 to start instead of the startx. Thx.

testingresults
2013-04-07, 05:03
ooopss :rolleyes: sorry guys i forgot to remove the # in the begining its working 100% ;)


No big deal, we all make mistakes.

Would you mind editing your first post to include this, though? A lot of users don't go past the first page.

testingresults
2013-04-07, 05:09
Thanks for the write up. It works great, I like going into the text mode like BT. Noob question but how do you leave the gui back into text mode without shutting down? I didn't create the symbolic link so I use gdm3 to start instead of the startx. Thx.


You're welcome.

Easiest way to get back to command line from gnome would be using 2 sets of key cominbations.


First press: "Ctrl+Alt+F1"
Then, press: "Ctrl+C"

The first one will tab the screen back to the command line window; the second one will send a INT signal to the currently running process from that instance of bash (in this case, gnome).

Hope that works for you.

Vulpi
2013-04-07, 09:32
it can be done using only one hand!
What are you doing with your other hand? ;)

testingresults
2013-04-12, 23:39
What are you doing with your other hand? ;)

Need my right hand free to reach |

Vulpi
2013-04-14, 12:39
Need my right hand free to reach |
More fun than eating pizza!

g0tmi1k
2013-05-17, 08:34
If you want a quick copy/paste method:


cp -n /etc/X11/default-display-manager{,.bkup}
echo > /etc/X11/default-display-manager
cp -n /etc/gdm3/daemon.conf{,.bkup}
sed -i 's/^.*AutomaticLoginEnable = .*/AutomaticLoginEnable = True/' /etc/gdm3/daemon.conf
sed -i 's/^.*AutomaticLogin = .*/AutomaticLogin = root/' /etc/gdm3/daemon.conf
ln -s /usr/sbin/gdm3 /usr/bin/startx # Old school ;)

testingresults
2013-05-18, 20:58
If you want a quick copy/paste method:


cp -n /etc/X11/default-display-manager{,.bkup}
echo > /etc/X11/default-display-manager
cp -n /etc/gdm3/daemon.conf{,.bkup}
sed -i 's/^.*AutomaticLoginEnable = .*/AutomaticLoginEnable = True/' /etc/gdm3/daemon.conf
sed -i 's/^.*AutomaticLogin = .*/AutomaticLogin = root/' /etc/gdm3/daemon.conf
ln -s /usr/sbin/gdm3 /usr/bin/startx # Old school ;)



Wow, very efficient! I like...
Mind if include this in the initial post?

g0tmi1k
2013-05-19, 09:46
Wow, very efficient! I like...
Mind if include this in the initial post?
Not at all! Please, go ahead and share it wherever =)

Thanks for making the original post - I know a couple of people have been asking for this!

some1learning
2013-05-27, 07:42
ty 4 sharing! big help!

samtech
2013-06-03, 07:56
I am noob, if my question is irrelevant then please don't mind.
I have created a regular user in my kali installation. I use is for day to day tasks and login as root when i learn pentesting.

I want to know a thing, in daemon.conf if i set AutomaticLogin=root then xsession will run as root user even if i login as non-root user.
If i set it to non-root user then possibly (i do not know) it will not work well when i login as root

Is there any way to start xsession with the credentials of logged-in user?

Z1gn@l
2013-06-03, 11:40
I seriously cant believe we are going through all this for something simple that can be achieved through sysv-rc-conf, xinit, .bash_login and .xinitrc files!

samtech
2013-06-04, 13:45
Here is want i did to achieve the same.

# chkconfig gdm3 remove

Restarted, login at console, then
# startx

But only the problem i see is, when i login as non-root user xfce session disable restart and shutdown buttons.
However if i login as root then everything is fine.

testingresults
2013-06-06, 00:59
I seriously cant believe we are going through all this for something simple that can be achieved through sysv-rc-conf, xinit, .bash_login and .xinitrc files!

I fail to see how copying 6 short lines of code and pasting it into a terminal qualifies as "all this."

I suppose everything is subjective though...

kennedypj
2013-07-21, 05:18
This is easier to me, but I'm open to suggestions or issues -

ls /etc/rc2.d/*
Now look at the file output for an xwin display manager starting up via 'S' at the beginning of the filename to start the service. In my case, it was /etc/rc2.d/S17gdm3. In my case, to stop or kill Xwindow at default runlevel 2, I just did this:

cp /etc/rc2.d/S17gdm3 /etc/rc2.d/S17gdm3.bak #safe keeping
mv /etc/rc2.d/S17gdm3 /etc/rc2.d/K17gdm3 # 'K' to kill sevice
reboot

The original idea is also very informative and useful to know.

testingresults
2013-07-23, 01:45
This is easier to me, but I'm open to suggestions or issues -

ls /etc/rc2.d/*
Now look at the file output for an xwin display manager starting up via 'S' at the beginning of the filename to start the service. In my case, it was /etc/rc2.d/S17gdm3. In my case, to stop or kill Xwindow at default runlevel 2, I just did this:

cp /etc/rc2.d/S17gdm3 /etc/rc2.d/S17gdm3.bak #safe keeping
mv /etc/rc2.d/S17gdm3 /etc/rc2.d/K17gdm3 # 'K' to kill sevice
reboot

The original idea is also very informative and useful to know.


Won't you still have to login twice using this method (in the instance of using gdm)?

arjunvs
2014-01-28, 03:29
You cannot lock the system doing this way as it would be easy to crack and get into the root or any account by just a combination of Ctrl+Alt+F1 and a Ctrl+C after that..
Isn;t that correct ?? or am i missing somehting :o

testingresults
2014-12-31, 23:32
You cannot lock the system doing this way as it would be easy to crack and get into the root or any account by just a combination of Ctrl+Alt+F1 and a Ctrl+C after that..
Isn;t that correct ?? or am i missing somehting :o

How so? You wouldn't be logged in automatically after starting up.

testingresults
2017-04-26, 04:00
Use with caution. This seems to be causing startup problems with Kali's new configuration.