Disable password expiration for Samba

Samba Logo

Here are the steps to disable a password expiration in Samba 4. 


To check what is the password expiration time:

samba-tool domain passwordsettings show

params.c:pm_process() - Processing configuration file "/etc/samba/shares.conf"
Password informations for domain 'DC=ff,DC=lan'

Password complexity: off
Store plaintext passwords: off
Password history length: 24
Minimum password length: 0
Minimum password age (days): 0
Maximum password age (days): 365

Disable password expiration:

samba-tool domain passwordsettings set --max-pwd-age=0
params.c:pm_process() - Processing configuration file "/etc/samba/shares.conf"
Maximum password age changed!
All changes applied successfully!

Check if the changes were accepted:

samba-tool domain passwordsettings show
params.c:pm_process() - Processing configuration file "/etc/samba/shares.conf"
Password informations for domain 'DC=ff,DC=lan'

Password complexity: off
Store plaintext passwords: off
Password history length: 24
Minimum password length: 0
Minimum password age (days): 0
Maximum password age (days): 0

Move a running process to a new screen shell

Linux Logo

The purpose of this article is to show you how to move a process from your traditional shell to a new screen session.

Example

  1. The first thing to do is to suspend the process. In my case, mv can be suspended by typing ctrl+z.

  2. Secondly, resume the process in background:
    $ bg

  3. Now, we will detach the process from its parent (the shell). So, when the parent process will be terminated, the child (mv) will be able to continue. For this, we use the disown builtin:
    $ disown mv

  4. Launch a screen session:
    $ screen

  5. As we are in a screen session, we will retrieve the mv process. To do so, we use the reptyr command which take a pid:
    $ reptyr <pid>

  6. To avoid the tedious pid research, we can use the pgrep command:
    $ reptyr $(pgrep mv)

Now the process is in a screen shell, we can safely detach our session and no longer worry about killing our X server or close our ssh connection.

 

Bacula: delete volumes without confirmation

Bacula-LogoLet's say you have to purge and clear your old backup files from Bacula. Going through them one by one is a lengthy process (especially if you have to-disk backups):

The long way: in bconsole, type:

*delete

You have the following choices:
     1: volume
     2: pool
     3: jobid

*volume

Defined Pools:
     1: Default
     2: File
     3: Scratch
     4: alt-pool

+---------+------------+-----------+--------------+-----------+---------------------+
| MediaId | VolumeName | VolStatus | VolRetention | MediaType | LastWritten         |
+---------+------------+-----------+--------------+-----------+---------------------+
|       1 | ALT0001    | Full      |    1,209,600 | File      | 2015-10-05 00:03:02 |
+---------+------------+-----------+--------------+-----------+---------------------+

Enter *MediaId or Volume name: ALT0001

Finally you get a confirmation: are you sure? (yes/no). That's 5 steps! If you need to delete 50 volumes, you'll be in for a while. Luckily, bacula has some shortcuts:

delete yes volume=ALT0001

The above command will achieve you the same results in 1 step and quickly delete as many volumes as needed.

PS: For those whoe don't know, Bacula is an open-source, enterprise grade backup suite, running on Windows and Linux.

Postfix mail queue commands

postfix1Some useful commands to check the Postfix mail queue:

View what is in the queue:

mailq

Attempt to resend the queued messages (flush queue):

postfix -f

Delete all emails that are deferred for one reason or another:

postsuper -d ALL deferred

Delete all messages in the queue

postsuper -d ALL

Disable GUI in Ubuntu Desktop

ubuntu-logo112
Q:
How can I disable the GUI from starting up in Ubuntu desktop?

A: You have to remove the lightdm package. 

sudo apt-get remove lightdm

This will prevent the desktop from starting up. If you want, you can still start it by running startx from the console