При создании сеанса, скрипт запуска сеанса берёт содержимое из /etc/skel (настройки всех пользователей), и из каталога /etc/guest-sessiion/skel (настройки именно гостя) , также при запуске он анализирует наличие скрипта /etc/guest-session/prefs.sh , при его наличии, запускает prefs.sh .
Каталог /etc/guest-session/ и скрипт /etc/guest-session/prefs.sh не входят ни в один пакет, так что ими может управлять системный администратор.
В Убунту есть возможность предоставить гостевой доступ к системе. Всяк входящий через гостевой доступ будет видеть систему как в первый раз, то есть любые изменения пропадут. В данной статье рассказывается как владельцу компьютера, предоставляющему гостевой доступ, настроить внешний вид и поведение.
При старте гостевого сеанса, создаётся временная учётная запись пользователя, чей домашний каталог располагается в /tmp. Чтобы контролировать сей процесс с релиза Ubuntu 11.04 есть пара хуков, помогающих контролировать домашнюю директорию пользователя:
Использование дополнительного пользовательского аккаунта облегчает настройку гостевого сеанса.
sudo mkdir /etc/guest-session
sudo ln -s /home/guest-prefs /etc/guest-session/skel
Теперь при старте гостевого сеанса настройки будут браться из guest-prefs.
cp -rT /home/guest-prefs $HOME
chown -R $USER: $HOME
С релиза Убунту 14.04 при входе в гостевой сеанс показывается диалоговое предупреждение о временной природе данного сеанса и что все изменения пропадут при выходе. Окно держится на экране около 4 секунд и :
Если вы хотите дать гостям возможность сохранять данные в вашем компьютере, то нужно создать папку /var/guest-data/
sudo mkdir -m 0777 /var/guest-data
Упоминание для гостей, что они могут сохранять в неё данные, упоминается в диалоговом окне, если вы его не отключали.
Если вы хотите просто отключить возможность гостевого сеанса в вашей системы, то достаточно добавить строку allow-guest=false в файл /etc/lightdm/lightdm.conf до релиза Ubuntu 14.04, а с релиза 14.04 и выше во вспомогательные конфигурационные в каталоге /usr/share/lightdm/lightdm.conf.d/. Например, в /usr/share/lightdm/lightdm.conf.d/50-no-guest.conf
sudo sh -c ‘printf «[SeatDefaults]\nallow-guest=false\n» >/usr/share/lightdm/lightdm.conf.d/50-no-guest.conf’
Эта команда создаёт небольшой конфигурационный файл. Чтобы снова разрешить гостевой сеанс, просто удалите этот файл:
sudo rm /usr/share/lightdm/lightdm.conf.d/50-no-guest.conf
Дата последней правки: 2014-06-06 11:54:52
This is relevant. Perhaps even a dupe if the answer works for you: Create guest account with restricted access to applications.
I have no idea how Ubuntu does it. If you need «exactly like Ubuntu», you’ll have to edit your question and explain what that means. However, the links provided in the linked answer give the ways you can limit a user’s authority and are almost certainly how Ubuntu has implemented whatever they’ve implemented behind the scenes. Try it.
It turns out it’s quite simple with GDM. I assume you’re using GDM since you’re also using Gnome. First, create the guest user account with a blank password:
sudo useradd -d /tmp/guest -p $(openssl passwd "") guest
The openssl passwd «» will return the hash of the empty string, thereby setting the password to blank.
Now, all you need are these two scripts:
This is executed after you log in and will create the /tmp/$guestuser ( /tmp/guest by default) directory and copy the default files from /etc/skel to it. To change the default username for the guest user, set guestuser to something else at the beginning.
#!/bin/sh guestuser="guest" ## Set up guest user session if [ "$USER" = "$guestuser" ]; then mkdir /tmp/"$guestuser" cp /etc/skel/.* /tmp/"$guestuser" chown -R "$guestuser":"$guestuser" /tmp/"$guestuser" fi exit 0
This is executed after you log out and will remove the /etc/$guestuser directory and all its contents. Make sure to set guestuser to the same value in both scripts.
#!/bin/sh guestuser="guest" ## Clear up the guest user session if [ "$USER" = "$guestuser" ]; then rm -rf /tmp/"$guestuser" fi exit 0
Finally, make the two scripts executable:
sudo chmod 755 /etc/gdm/PostLogin/Default /etc/gdm/PostSession/Default
Now, just log out and you will see your new guest user. You can log in by selecting it and hitting Enter when prompted for a password. The guest user won’t be able to use sudo since that is the default for all users anyway. Only users explicitly mentioned in /etc/sudoers or those who are members of groups explicitly mentioned in sudoers (such as wheel or sudo , depending on your distribution) can use sudo .
If you are using a recent version of GDM, it may disable the login button while the password box is empty. To work around this you can tell GDM not to prompt for the password for specific groups. The caveat is that this will also bypass the session selection menu for members of that group. If you want to do this you should add this line at the beginning of /etc/pam.d/gdm-password :
auth sufficient pam_succeed_if.so user ingroup guest
Sometimes I have friends in my house that want use my computer. How can they use a guest account without typing a password?
user@ubuntu:~$ sudo adduser guest user@ubuntu:~$ sudo passwd -d guest
This will add a user called «guest», then delete her password. You can log in from both the standard getty login prompt and graphical login managers like GDM. This works for me on Ubuntu 10.10.
However, apparently this doesn’t work for some people using Ubuntu. Thus:
guest:$6$m4CpcgBw$i9XLGaUNToClOJ1X5Grug/COUjlkhoPv1:15048:0:99999:7.
guest:U6aMy0wojraho:15048:0:99999:7.
The origin of this method is from the Ubuntu livecd. The default user (ubuntu) requires no login password. If you look at /etc/shadow on the livecd, U6aMy0wojraho is the encrypted form of the magic password used. I explain this to emphasize this is not a general linux solution, but something specifically Ubuntu.
There will be a guest account by default.Try clicking your username at the top-right corner and activate «Guest Session» under there. Also see the posts below,
Create a new user, without administration access, then click in: «No passwd at login». This may solve your problem, but you can log in, and at your name (at right up): Guest-session.
Here’s how I created Guest Account without password with tmpfs (RAM is used as disk space)
# Run these as root or prefix sudo useradd -c "Guest [click here]" guest ; # add a user named passwd guest ; # just give any password passwd -d guest ; # delete the password to make password less login UserID=$(id -u guest) ; # to set ownership of /home/guest directory GroupIP=$(id -g guest); # get the group id for home directory permission usermod -aG audio,plugdev,video,netdev,bluetooth guest ; # give device access (this is for debian) rm -rf /home/guest ; # in case there are files/directories mkdir -pv /home/guest ; # should mount if non empty but make sure it is empty echo "tmpfs /home/guest tmpfs rw,size=1024M,nosuid,uid=$UserID,gid=$GroupID 0 0" >> \ /etc/fstab mount /home/guest
Now you can login with guest without password everytime and data is stored up to 1GB in RAM which will be deleted on system shutdown!
Adblock