LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-07-2013, 10:16 PM   #1
13stein.j
Member
 
Registered: May 2013
Location: Brooklyn, New York
Distribution: Linux Mint 15/Ubuntu 13.10/Debian 7/SUSE 11.x/openSUSE 12.3/RHEL 6.4/Fedora 18/Slackware, and 5 more
Posts: 111

Rep: Reputation: 6
Guest Account in Slackware?


For neighborhood friends and relatives that come over, can I create a guest account, with no password, and that all files added would be deleted automatically at logout?
 
Old 06-07-2013, 11:26 PM   #2
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 855

Rep: Reputation: 169Reputation: 169
You can create a guest account in the normal way and give it a password, then edit /etc/passwd to remove the first x right after the username. For example, if the user name is called guest and you gave it uid 1002 and group 103, the entry in passwd might look like this:

Code:
guest:x:1002:103::/home/guest:/bin/bash
edit it to this:

Code:
guest::1002:103::/home/guest:/bin/bash
Now "guest" won't be prompted for a password when he logs in.

For logout, you might look into writing a .bash_logout script to delete anything you don't want to retain for the account. If you are using a shell other than bash, see if it has a similar interactive shell logout script.

Hope that helps.

Now for my unasked for personal opinion, I would not create an account on my system that didn't have a password, especially if my system was accessible from the net or if there were other unsecured systems on my local network. It is so quick and easy to set up a user account, I would just create one if a guest wanted to use my computer, and then delete the account and all associated files when they are done. I'd also put them in their own unique group. Create the group and leave it permanently. useradd the user as needed, and userdel when they are gone.
 
Old 06-07-2013, 11:31 PM   #3
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware -current, 14.2
Posts: 1,102

Rep: Reputation: 227Reputation: 227Reputation: 227
You can create a password-less account that upon login opens a virtualbox slack install on a vtty, let's say :1 on tty8.

In this regard, the guest isn't mucking with your real stuff, and upon logout the vm can be restored to pristine, with no trace of the goings-on whilst the vm was up and running.

cheers,
 
Old 06-08-2013, 03:47 AM   #4
BlackRider
Member
 
Registered: Aug 2011
Posts: 295

Rep: Reputation: 101Reputation: 101
I think there are many ways to deal with this.

Z038 offers a good solution.

Other solution is to create a guest account that has a home in a tmpfs filesystem that gets populated at startup (with scripts). At shutdown (not logout) the home of the guest would get deleted. The advantage of this is that no guest home data is actually written to disk.
 
Old 06-08-2013, 07:27 AM   #5
13stein.j
Member
 
Registered: May 2013
Location: Brooklyn, New York
Distribution: Linux Mint 15/Ubuntu 13.10/Debian 7/SUSE 11.x/openSUSE 12.3/RHEL 6.4/Fedora 18/Slackware, and 5 more
Posts: 111

Original Poster
Rep: Reputation: 6
The password is solved, but if I put the home folder in the /tmp directory, wouldn't it already do it?
 
Old 06-08-2013, 08:25 AM   #6
commandlinegamer
Member
 
Registered: Dec 2007
Posts: 135

Rep: Reputation: 35
Quote:
Originally Posted by 13stein.j View Post
The password is solved, but if I put the home folder in the /tmp directory, wouldn't it already do it?
Only if you've already set up /tmp to use RAM rather than a partition.

/tmp is not cleared automatically, otherwise.
 
Old 06-08-2013, 08:28 AM   #7
13stein.j
Member
 
Registered: May 2013
Location: Brooklyn, New York
Distribution: Linux Mint 15/Ubuntu 13.10/Debian 7/SUSE 11.x/openSUSE 12.3/RHEL 6.4/Fedora 18/Slackware, and 5 more
Posts: 111

Original Poster
Rep: Reputation: 6
Quote:
Originally Posted by commandlinegamer View Post
Only if you've already set up /tmp to use RAM rather than a partition.

/tmp is not cleared automatically, otherwise.
And how do I set this?
 
Old 06-08-2013, 08:50 AM   #8
BlackRider
Member
 
Registered: Aug 2011
Posts: 295

Rep: Reputation: 101Reputation: 101
Quote:
Originally Posted by 13stein.j View Post
And how do I set this?
You have to edit /etc/fstab to make that work.

For example:

Code:
tmpfs            /tmp         tmpfs       nodev         0   0
Of course, options you apply may vary. Check the documentation carefully.
 
Old 06-08-2013, 09:15 AM   #9
Stephen Morgan
Member
 
Registered: Feb 2011
Location: England
Distribution: Slackware
Posts: 163

Rep: Reputation: 17
/tmp often takes up a lot of space, if you use it to make iso images, or to build slackbuild packages, say. So putting it in RAM can be tricky if you don't have many spare gigs of memory.

If you don't keep your machine on all the time you could use a live USB, maybe Slax, which won't use your harddrive at all, for guests.

Otherwise it will be different depending on whether your guests are okay with a command line or will want a graphical login. But if you use SSH make sure any passwordless accounts can't login remotely.
 
Old 06-08-2013, 09:35 AM   #10
13stein.j
Member
 
Registered: May 2013
Location: Brooklyn, New York
Distribution: Linux Mint 15/Ubuntu 13.10/Debian 7/SUSE 11.x/openSUSE 12.3/RHEL 6.4/Fedora 18/Slackware, and 5 more
Posts: 111

Original Poster
Rep: Reputation: 6
On another note, how would I write a bash script that deletes those files, and set it to run on logout?
 
Old 06-08-2013, 11:09 AM   #11
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,833
Blog Entries: 1

Rep: Reputation: 1230Reputation: 1230Reputation: 1230Reputation: 1230Reputation: 1230Reputation: 1230Reputation: 1230Reputation: 1230Reputation: 1230
Quote:
Originally Posted by 13stein.j View Post
On another note, how would I write a bash script that deletes those files, and set it to run on logout?
In bash you can use

Code:
~/.bash_logout
If you want to run something when a computer is shutting down, You can create the following file:

Code:
/etc/rc.d/rc.local_shutdown
Whatever this file contains will be executed on shutdown.
 
Old 06-08-2013, 02:53 PM   #12
fatalfrrog
Member
 
Registered: May 2011
Distribution: Slackware
Posts: 57

Rep: Reputation: 31
You might run into problems with deleting the ~/.bash_logout file. You can make the file immutable, but I would rather add:
Code:
[[ $(whoami) == "guest" ]] && echo "rm -rf ~/" >> .bash_logout
to your /etc/profile and you'll be good to go
 
Old 06-08-2013, 03:42 PM   #13
13stein.j
Member
 
Registered: May 2013
Location: Brooklyn, New York
Distribution: Linux Mint 15/Ubuntu 13.10/Debian 7/SUSE 11.x/openSUSE 12.3/RHEL 6.4/Fedora 18/Slackware, and 5 more
Posts: 111

Original Poster
Rep: Reputation: 6
Quote:
Originally Posted by BlackRider View Post
You have to edit /etc/fstab to make that work.

For example:

Code:
tmpfs            /tmp         tmpfs       nodev         0   0
Of course, options you apply may vary. Check the documentation carefully.
What would happen if I were to do this:
Code:
tmpfs            /home/guest         tmpfs       nodev         0   0
, would this empty the folder on logout without causing any problems?
 
Old 06-08-2013, 04:21 PM   #14
Z038
Member
 
Registered: Jan 2006
Distribution: Slackware
Posts: 855

Rep: Reputation: 169Reputation: 169
I would suggest "defaults" instead of "nodev" for the mount attributes. That is:

Code:
tmpfs            /home/guest         tmpfs       defaults         0   0
That will put the guest home in a temp filesystem, but no, it will not get rid of it when guest logs out. A system shutdown will wipe it out, or you can unmount the filesystem. If you unmount it as root user with command "umount /home/guest", it'll disappear.

You might be able to set it up as an autofs filesystem using the automount facility. I've never used it, so I can't guide you, but I believe the way it works is that automount can mount a filesystem when it is referenced, and unmount it after some period of inactivity. I do not know if automount can mount a tmpfs, but if it can, then that might be a good automated solution for you. If you can get that to work, then you won't need to put it in fstab or issue a umount to get rid of it when the guest logs off.
 
Old 06-08-2013, 05:08 PM   #15
13stein.j
Member
 
Registered: May 2013
Location: Brooklyn, New York
Distribution: Linux Mint 15/Ubuntu 13.10/Debian 7/SUSE 11.x/openSUSE 12.3/RHEL 6.4/Fedora 18/Slackware, and 5 more
Posts: 111

Original Poster
Rep: Reputation: 6
Quote:
Originally Posted by fatalfrrog View Post
You might run into problems with deleting the ~/.bash_logout file. You can make the file immutable, but I would rather add:
Code:
[[ $(whoami) == "guest" ]] && echo "rm -rf ~/" >> .bash_logout
to your /etc/profile and you'll be good to go
Under who am I fill in the user's name, correct?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] VirtualBox guest additions for init 3 Slackware guest? kikinovak Slackware 2 06-04-2013 10:36 AM
how to create a guest account Mike_P Linux - Newbie 6 04-27-2012 08:03 PM
Is there a Guest account on FC5? Antarctica Fedora 1 09-04-2006 11:59 PM
creating a guest account tardigrade Linux - General 2 02-04-2005 03:33 PM
Understanding the guest account calabash Linux - Networking 16 03-06-2004 02:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration