Set Fn key to always on with Apple keyboard

If you’re using an Apple keyboard with Linux and want to use the Function keys normally, for example F2 to rename files, it’s possible to do so with a simple modification.

Open a terminal and run this command:

sudo -s 'echo 2 > /sys/module/hid_apple/parameters/fnmode'

If you want something other than Function keys taking precedence there are other options.

The following are the accepted values:

  • 0 = disabled : Disable the ‘fn’ key. Pressing ‘fn’+’F8’ will behave like you only press ‘F8’
  • 1 = fkeyslast : Function keys are used as last key. Pressing ‘F8’ key will act as a special key. Pressing ‘fn’+’F8’ will behave like a F8.
  • 2 = fkeysfirst : Function keys are used as first key. Pressing ‘F8’ key will behave like a F8. Pressing ‘fn’+’F8’ will act as special key (play/pause)

 

References:

https://superuser.com/questions/79822/how-to-swap-the-fn-use-of-function-keys-on-an-apple-keyboard-in-linux/1141657

How to Fix Ubuntu Landscape – Invalid Machine token

Ubuntu Landscape allows you to keep systems updated when deployed in large clusters.

If you clone a machine and look in its logs you might find an error message similar to the ones below.

Error message:

during refresh: cannot check: cannot send status to server: bad server status 403 (URL: https://livepatch.canonical.com/api/machine/dfb8755a82202da0678c99065c9501ab): {"error": "Invalid Machine Token"}

You may also see this warning in the motd.

 * Canonical Livepatch is enabled.
- Livepatch server check failed.
Please see /var/log/syslog for more information.

 

The solution is to remove, reinstall landscape and register the node again with your license key.

apt remove landscape-common 
apt install landscape-common

It’s not clear if this is a bug or intended behavior for Landscape.

For large deploymens this could be problematic.

Fix slow GUI, sluggish interface with Mint Cinnamon

 

If you have been using your system heavily, with multiple workspaces, various applications that are not entirely memory efficient, these combined factors can lead to your interface feeling sluggish.

In order to resolve this issue without having to restart the entire system issue this command in a terminal windows to restart mind and preserve your workspaces and windows.

pkill -HUP -f "cinnamon --replace"

 

References:
https://askubuntu.com/questions/143838/how-do-i-restart-cinnamon-from-the-tty

 

SSH Tunneling on Linux and Mac

Do you need to tunnel to another machine frequently?

Would you like an App to save time and make it more user friendly?

Well, good news!

There’s a solution for Linux and Apple machines.

For Linux you can try Gnome SSH Manager.

From their website:

gSTM is a front-end for managing SSH-tunneled port redirects. It stores tunnel configurations in a simple XML format. The tunnels (local, remote and dynamic) can be managed and individually started/stopped through one simple interface.

https://sourceforge.net/projects/gstm/

 

Another option for Linux is IOSSHy.

From their website:

IOSSHy provides an easy to use desktop tool to quickly create and destroy SSH tunnels and launch commands based on a preconfigured setup.

Password are stored in the keyring provided by the operating system (ES: gnome’s keyring, kde’s kwallet, osx keychain, etc…)

https://www.linux-apps.com/content/show.php/IOSSHy?content=119689

 

For MacOS (OSX) it’s called Tunnel Manager.

From their website:

SSH Tunnel Manager is a macOS application to manage your SSH tunnels. If you don’t know what that is, quite honestly, maybe you don’t need SSH Tunnel Manager, but if you appreciate the power of connecting together two networks using the SSH protocol, then STM is for you.

https://www.tynsoe.org/v2/stm/

 

Did you know: SSH Tunneling is also commonly referred to as LocalForwarding, RemoteForwarding, Local Port Forwarding, Remote Port Forwarding.

 

Debian Unattended Security Updates

Follow these instructions and set your email to receive notifications.

https://wiki.debian.org/UnattendedUpgrades

apt-get install unattended-upgrades apt-listchanges

nano /etc/apt/apt.conf.d/50unattended-upgrades

Set your email to receive notificaitons:
Unattended
-Upgrade::Mail "your@email.com";

To activate unattended-upgrades, you need to ensure that the apt configuration stub /etc/apt/apt.conf.d/20auto-upgrades contains at least the following lines:

  • nano /etc/apt/apt.conf.d/20auto-upgrades
    APT::Periodic::Update-Package-Lists "1";
    APT::Periodic::Unattended-Upgrade "1";
    dpkg-reconfigure -plow unattended-upgrades

 

Alternatively, you can also create the apt configuration file /etc/apt/apt.conf.d/02periodic to activate unattended-upgrades:

  • nano /etc/apt/apt.conf.d/02periodic
    
    

     

    Below is an example /etc/apt/apt.conf.d/02periodic:

    • // Control parameters for cron jobs by /etc/cron.daily/apt-compat //
      
      
      // Enable the update/upgrade script (0=disable)
      APT::Periodic::Enable "1";
      
      
      // Do "apt-get update" automatically every n-days (0=disable)
      APT::Periodic::Update-Package-Lists "1";
      
      
      // Do "apt-get upgrade --download-only" every n-days (0=disable)
      APT::Periodic::Download-Upgradeable-Packages "1";
      
      
      // Run the "unattended-upgrade" security upgrade script
      // every n-days (0=disabled)
      // Requires the package "unattended-upgrades" and will write
      // a log in /var/log/unattended-upgrades
      APT::Periodic::Unattended-Upgrade "1";
      
      
      // Do "apt-get autoclean" every n-days (0=disable)
      APT::Periodic::AutocleanInterval "21";
      
      
      // Send report mail to root
      //     0:  no report             (or null string)
      //     1:  progress report       (actually any string)
      //     2:  + command outputs     (remove -qq, remove 2>/dev/null, add -d)
      //     3:  + trace on
      APT::Periodic::Verbose "2";
      
      Unattended-Upgrade::Mail "your@email.com";
      
      

       

Using unattended-upgrades on Debian and Ubuntu

How to install and remove Sophos Free Antivirus for Linux

This is a great thing to have around.

Beware, it will slow your system down a bit if you have lots of files or large files that will be scanned.

Do not use on a development machine where you compile things or it will be very slow to create builds. Your mileage may vary.

Install

1. If you haven’t already downloaded the installer, do as follows:
a) Go to http://www.sophos.com/en-us/products/free-tools.aspx
b) Find Sophos Anti-Virus for Linux Free Edition and click Download. Follow the instructions to download the tarball to a temporary directory, for example /home/myuser/Downloads.

2. Change to the temporary directory and untar the tarball:
tar -xzvf .

If you have a GUI install you can usually Right click and choose Extract Here to avoid having to issue commands in the terminal.

3. Run the install script:

a) You might have to chmod +x the install.sh file before you can run it.

b) Then  you can run

sudo ./sophos-av/install.sh

4. The installer guides you through the installation:
■ When prompted for the type of auto-update you want, select Sophos.
■ When prompted for the version you want, select Free.
Sophos Anti-Virus is installed in the directory that you selected.

Uninstall

sudo /opt/sophos-av/uninstall.sh

 

Official Sopho Antivirus for Linux PDF Manual

 

List process run by user

 

Replace the [username] with the required username

If you want to use ps then

ps -u [username] 

OR

 ps -ef | grep <username> 

OR

ps -efl | grep <username>