Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-03-14 11:11:23

Maria77
Member
Registered: 2019-03-14
Posts: 3

Prevent User Login on Xfce Debian System

Hi,

how can I prevent Users to log in to Xfce?

I`m using Debian and changed the /etc/passwd file user entry, for example as this:

user7:x:1003:1019:user7,,,:/home/user7:/sbin/nologin

/sbin/nologin is used to prevent user to login:
https://www.cyberciti.biz/tips/linux-pr … ystem.html

But if I use user7 for login on my system, I still can login in Xfce...

How can I prevent this?

Thank you very much in advance,

cheers
Maria

Offline

#2 2019-03-14 15:49:46

ctac
Member
Registered: 2017-05-08
Posts: 57

Re: Prevent User Login on Xfce Debian System

Try to comment the line :

#user7:x:1003:1019:user7,,,:/home/user7:/bin/bash

In my debian system, nologin is in /usr/sbin/
but it prevent only to login in TTY (Ctrl+Alt+F3).

Offline

#3 2019-03-14 17:19:52

Maria77
Member
Registered: 2019-03-14
Posts: 3

Re: Prevent User Login on Xfce Debian System

Hi, ctac, thank you for answering..

I forgot to mention, that I just need to prevent LOGIN of the User, but not to deactivate the user!

Explanation:
I have a SAMBA server running on Debian and my users are accessing the files and folders of the server using Windows Clients.
So I would of course let the User to access the Files over SAMBA, but NOT to login to the system over the xfce login Mask...
If I commtent the User, he will not be able to access the Files over Samba...

I`m sure there must be a solution for this, but all my Google research did not give me anything... ;(

Hopefully this community here can help me

Thanks and cheers,

Maria

Offline

#4 2019-03-14 22:48:34

ctac
Member
Registered: 2017-05-08
Posts: 57

Re: Prevent User Login on Xfce Debian System

Can't find a way via Xsession or Xinit so if you start your session with lightdm, you can try this way.

In lightdm.conf after [Seat:*], add a line :

session-setup-script =/etc/lightdm/start_user_session.sh

Create a file /etc/lightdm/start_user_session.sh like this one :

if ( test $(sed '/^'"$USER"':/!d;s/.*://' '/etc/passwd') = "/bin/false" ) ; then 
xmessage -bg black -fg blue -center -title 'Information' -buttons 'sorry' -geometry 800x100 "Hello and welcome $USER , you are not allowed to login" -timeout 5
pkill $(ps -C xfce4-session -o pid=)
fi

Offline

#5 2019-03-15 18:36:21

ctac
Member
Registered: 2017-05-08
Posts: 57

Re: Prevent User Login on Xfce Debian System

Come back with another answer.
with :

uname -a
Linux debian-linux 4.19.0-2-amd64 #1 SMP Debian 4.19.16-1 (2019-01-17) x86_64 GNU/Linux

All is explain in man 5 Xsession DEFAULT STARTUP PROCEDURE SUPPLIED SCRIPTS
With a shell set to /bin/false in /etc/passwd and a file named /etc/X11/Xsession.d/10_valid_user_launch

cat /etc/X11/Xsession.d/10_valid_user_launch 
# deny user with SHELL=/bin/false to log in Xsession

if ( test $(sed '/^'"$USER"':/!d;s/.*://' '/etc/passwd') = "/bin/false" ) ; then 
errormsg "Hello and welcome $USER , you are not allowed to login"
fi

Offline

#6 2019-04-02 08:57:40

Maria77
Member
Registered: 2019-03-14
Posts: 3

Re: Prevent User Login on Xfce Debian System

Hi, ctac wink
Sorry for not Answering, was blown away by the flue... ;(
Great! I`ll try that, Thanks.. smile :*

Offline

#7 2019-04-02 16:31:50

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: Prevent User Login on Xfce Debian System

You can take a look at this thread, too:

Disable a user's login without disabling the account

Offline

Board footer

Powered by FluxBB