[SOLVED]How to disable autologin and guest account?

Post here if you are a new Porteus member and you're looking for some help.
meet
Black ninja
Black ninja
Posts: 88
Joined: 31 Mar 2020, 04:37
Distribution: Porteus 4.0

[SOLVED]How to disable autologin and guest account?

Post#16 by meet » 11 Apr 2020, 03:23

Rava wrote:
10 Apr 2020, 22:55
meet wrote:
06 Apr 2020, 14:16
I just want a simple interface where it just asks me to login
You mean a GUI interface or the text terminal interface?
Aka runlevel 4 vs 3.
Any of the two. Graphical is always better. But if that's not available, a terminal prompt is also fine.
What I want is:
1. Create a user of my own. (No guest or root default provided)
2. Set the password for my own user
3. OS to ask me to login when it boots up (like any other OS installed on HDD)

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

[SOLVED]How to disable autologin and guest account?

Post#17 by Rava » 11 Apr 2020, 04:01

meet wrote:
11 Apr 2020, 03:23
1. Create a user of my own. (No guest or root default provided)
You need a root default or else you cannot access the root account when needed. Like you need doing the below.

You can just do the following:
Change passwords for guest and root to something more secure.

Then edit manually the files /etc/passwd and /etc/shadow

And also all other files in /etc that refer to the user guest.
In XFCE that would be these files (all in /etc/):

Code: Select all

passwd shadow group gshadow slim.conf sudoers
Maybe also /etc/samba/smb.conf and /etc/rc.d/rc.S

Replace "guest:" with the username you want, e.g. with "meet:" in /etc/passwd and /etc/shadow and whatever the entry is in the other files above.

You can use grep -R guest * 2>/dev/null in /etc/ to find all occurrences of "guest" in all files in /etc/

Cave! If you use a program that has its settings stored elsewhere than /etc/, e.g. in /opt/ you have to change entries there as well.
________________________________________

When you also want to change the user home directory from /home/guest into /home/meet/ you have to do much more work. Change the entry in /etc/passwd from /home/guest into e.g. /home/meet

Go to /mnt/live/memory/images and type find . 2>/dev/null|grep "/home/guest$"

Code: Select all

guest@porteus:/mnt/live/memory/images$ find . 2>/dev/null|grep "/home/guest$"
./003-xfce-porteus5.xzm/home/guest
./002-xorg.xzm/home/guest
./001-core.xzm/home/guest
In my case, would I want to change the user guest into the user rava, I would have to do the above with the two files and also edit the three modules as found above, renaming the folder home/guest/ into home/rava/ in each module that contains the folder.

When you use the rootcopy folder for saving changes you have to rename home/guest/ as well, and when you use the changes.dat you have to change the home/guest/ as well. How that is done I cannot tell you, I never used changes.dat.

xzm2dir the module (in my example, do so for all three modules found), but either into your /tmp/ folder when there is enough space, or into a Linux filesystem. Do not use a FAT32 or NTFS filesystem, or else all files and folders extracted would get global read write and execute permissions - and that would be a security disaster.

As seen above with our mere two files:

Code: Select all

guest@porteus:/etc$ ls -l passwd shadow 
-rw-r--r-- 1 root root   1388 Dec  7 06:40 passwd
-rw-r--r-- 1 root shadow  779 Dec  7 06:40 shadow
These are files (among many others) that should be writeable only for root.
Also, the folder root/ should only be accessible for root.

After having created the new modules via dir2xzm, you best keep a backup of your original modules, make sure all the changes I metioned are also in place, replace the original modules with the tweaked ones and reboot.

root should now have its password changed into the secure one you choose, a user guest should be no longer there, but a user meet, and the home folder should be /home/meet

Know when you start using other DE you gave to edit the module for that DE as well, and when you use a newer version of Port you have to do all the above again.


HTH!
Cheers!
Yours Rava

meet
Black ninja
Black ninja
Posts: 88
Joined: 31 Mar 2020, 04:37
Distribution: Porteus 4.0

[SOLVED]How to disable autologin and guest account?

Post#18 by meet » 11 Apr 2020, 04:10

Rava wrote:
11 Apr 2020, 04:01
meet wrote:
11 Apr 2020, 03:23
1. Create a user of my own. (No guest or root default provided)
HTH!
Hey rava! Thanks for the comprehensive explanation.

I'm gonna stick with part of the solution, to just change the name of the guest account to something that I want. The directories may still show guest, that's okay for now.
But thanks, this will definitely help people.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

[SOLVED]How to disable autologin and guest account?

Post#19 by Rava » 11 Apr 2020, 04:24

meet wrote:
11 Apr 2020, 04:10
I'm gonna stick with part of the solution, to just change the name of the guest account to something that I want. The directories may still show guest, that's okay for now.
Be aware that I edited my above post, I forgot you need to edit more than just the two files I first mentioned. Please refer to the most recent version of my post. I was still editing it when you already replied.

Make sure you only change the user name guest into e.g. meet, but not the home directory. You have to keep the entry of /home/guest so you cannot use e.g. awk or seed to change all occurrences of guest into your desired user name automatically in all mentioned files in /etc/ .
Also check if you use a DE that has more files than the one I mentioned above, and edit all. (via grep guest * 2>/dev/null)

You could use the replace function of mcedit but only replace the name when it appears as the user name itself and never the path, so do not "replace all", but check each entry to be replaced if you should do so or not.

Be aware that you edit crucial system files, so make sure you do not make mistakes.
Cheers!
Yours Rava

meet
Black ninja
Black ninja
Posts: 88
Joined: 31 Mar 2020, 04:37
Distribution: Porteus 4.0

[SOLVED]How to disable autologin and guest account?

Post#20 by meet » 05 May 2020, 03:04

Thanks Rava.

Your response was really helpful. As there were a lot (a lot lot) files in the DE that had guest user name reference, I've left the idea to change the user name. For the time being, I'll run it with guest user name.

Although, it's really irritating to see your username as guest, but as the OS doesn't have the desired option to simply change the user name (which is poorly designed idea), I'll stick to whatever's given. I do not believe that such a simple (extremely simple) thing to change user name should involve so many file changes. Should have used user codes everywhere in the files with user name master as a separate file, or something like that.

Post Reply