Solved How do I lock my screen ? || 13.0-RELEASE-p7 || XFCE

I am using 13.0-RELEASE-p7 / XFCE. I am looking for an easy way to lock my screen for times when I am taking a break from work. My first choice is to create an icon on the desktop clicking on which will lock the screen. If that's not possible I will type a command in the terminal. When I was using Linux almost all DEs offered the screen lock icon ootb.

How do I do this under FreeBSD ?
 
It's been a while since I've used XFCE so going by memory, but in the configuration/autostart look for anything related to "screensaver". I think the configuration options for it allow you to lock/not lock when it runs and configure a timeout for when it should run.
As for adding a button to something so you could manually run it, it should be possible, I just don't recall how to.
 
If you are using xscreensaver, you can set up an icon on your taskbar:

1645087839087.png


1645087883043.png
 
Make sure to login from a display manger (Slim, lightDM, XDM, etc.), or if Xorg is started from command line, lock the console (virtual terminal) with security/vlock for example.

Otherwise, when starting Xorg from console (xinit, startx), the Xorg locked session with whichever program is used, can be circumvented.

Anyone with access to the machine can change to the console where Xorg was initialized (Ctrl + Alt + FN) and can terminate Xorg (Ctrl ^C), which not only will terminate any program opened in Xorg, the person can also initialize a new Xorg session with full access to the users home directory as well as to other directories the user has read/write/access permissions, eventually also access to commands with super user permissions, if the user has super user privileges without password prompting granted (sudo/doas).

For securing the work machine further I would also investigate the possibility to disable ACPI powerdown, poweroff and reset functions.
 
The default should be <CTRL>+<ALT>+<DEL>

CLI alternative: xflock4
When I press <CTRL>+<ALT>+<DEL> only Log Out is clickable. The rest of the options are not responding to click.
Just tried xflock4 and it worked. xflock4 just activates the screensaver with screen lock.

Geezer ^^ This is doable.
 
Make sure to login from a display manger (Slim, lightDM, XDM, etc.), or if Xorg is started from command line, lock the console (virtual terminal) with security/vlock for example.
Xfce doesn’t offer its own login manager, so it can’t be started as FreeBSD boots in the same way as GNOME or KDE.
Source : https://freebsdfoundation.org/freebsd-project/resources/installing-a-desktop-environment-on-freebsd/
So I thought I cant use a display manager. I am using the command startxfce4 after login
 
Xfce doesn’t offer its own login manager, so it can’t be started as FreeBSD boots in the same way as GNOME or KDE.
That doesn't mean you can't install and use one of the mentioned display managers in post #6.
 
That doesn't mean you can't install one of the mentioned display managers in post #6.
I had followed that guide step by step. Before this attempt of installing FreeBSD I had tried installing FreeBSD some years ago but failed on this very step namely installing and configuring a display manager.

Which display manager do you recommend ? Any easy guide which I can follow ?
 
I don't use a display manger, can't comment about their advantages or disadvantages
Are you using FreeBSD as a server only ? Or are you using it as a desktop OS but starting your DE from commandline like me ? If its the latter then I don't see any reason to install a display manager. I boot my PC in the morning and shut it down at night so I need to type startxfce4 just once per day.
 
I have created a desktop launcher and added the following

Code:
Exec=xflock4

Now when I click on this icon the screensaver appears and the screen is locked.

[SOLVED]
 
Are you using FreeBSD as a server only ? Or are you using it as a desktop OS but starting your DE from commandline like me ?
I'm using as desktop, starting X session (and DE over ~/.xinitrc) from console (command line).

If its the latter then I don't see any reason to install a display manager. I boot my PC in the morning and shut it down at night so I need to type startxfce4 just once per day.
To secure the X session with a locking program implies to prevent other users having access to the opened X session. As I stated in post #6, anyone can terminate that X session by killing it and eventually starting a new one, with acces to the users and system files.

Is your system stationary at home, at work or a laptop, mobile wherever you go?
 
I'm another desktop user not using a display manager. Learned the hard way long time ago it's easier to debug issues with X and drivers using startx. A display manager is nice if there are multiple people using the system or to make it appear "prettier, more user friendly" because Windows and Macs set that basic expectation.
At home, I typically disable screen savers and just have xset +dpms in my .xinitrc because the dogs don't care and the wife won't touch my keyboard.
At work, follow company rules, so it's typically "lock screen if you are stepping away from desk".
 
For the last few decades the "pause/break" key usually has been the default and pre-configured shortcut to lock the session/screen or invoke the screensaver. (at least for proper OS, the major exception again being the "gaming-platform" from redmond...)

I've been using this key for this purpose extensively for 10+ years. Klicking on a desktop icon for this seems quite cumbersome...
 
A display manager seems like the easiest thing to do for a desktop. You won't have to deal with user sessions, privileges, and ttys.
Remember to use the operator group.
 
I use xfce screensaver:


But the way you start the session is important, I starts X from the terminal and this is my .xinitrc:

Code:
[ -f ~/.xsession-errors ] && mv ~/.xsession-errors ~/.xsession-errors.old
exec startxfce4 --with-ck-launch > ~/.xsession-errors 2>&1
 
Is your system stationary at home, at work or a laptop, mobile wherever you go?
My system is stationary at home.

tgl
One that I don't understand is if I don't follow this step

Code:
echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc

and instead of typing startx if I continue using startxfce4 what's the downside ?

I mean in both cases I am starting XFCE manually.
 
tgl
One that I don't understand is if I don't follow this step

Code:
echo "exec /usr/local/bin/startxfce4 --with-ck-launch" > ~/.xinitrc

and instead of typing startx if I continue using startxfce4 what's the downside ?

I mean in both cases I am starting XFCE manually.

I am not pretty sure but once you have a .xinitrc file startx read from it, and you can add more command, If you use directly startxfce4 it uses the script provided by the system.
Eventually both are invoking startxfce4 and do the same thing, the command I use produces also a log with some information.
 
Back
Top