Hi all,
You may want to work with your office system from another place, for instance from your house. It is a common event that your internet, or VPN gets disconnect, or the electricity becomes disconnected, because of some problems, and you cannot work with the system anymore, even sb turns it on, and connect the net.
I summarized what I found in some Ubuntu web pages, turning the system, and connecting the VPN, automatically.
1- How to reconnect VPN automatically in Ubuntu [1]
Right this bash script in a text file and save it:
while [ "true" ]
do
VPNCON=$(nmcli con status)
if [[ $VPNCON != *MyVPNConnectionName* ]]; then
echo "Disconnected, trying to reconnect..."
(sleep 1s && nmcli con up uuid df648abc-d8f7-4ce4-bdd6-3e12cdf0f494)
else
echo "Already connected !"
fi
sleep 30
done
Where:
MyVPNConnectionName is the name of your VPN connection in the Network Manager applet
df648abc-d8f7-4ce4-bdd6-3e12cdf0f494 is the uuid of your VPN connection. You can find it using the following command:
nmcli con
Save this script in your user personal directory, for example.
Do not forget to make this script executable by running the following command:
chmod +x /path/to/my/script/my_script
How to run this script automatically when a user has logged in?
It’s very easy. Just append the following line to your .profile (in the root of your user directory):
/path/to/your/script/my_script &
In some distributions, it may be the .bashrc file. In Debian it’s .profile (it doesn’t work as expected with .bashrc). Just choose what works for you.
Finally, save your changes, logout from your session, and log in again. The script should be automatically started, and your VPN should connect immediately. Hurray!
2- How to open terminal (or any other app) automatically after login [2]
Press the Super key (windows key).
Type "Startup Applications"
Click on the Startup Applications option
Click "Add"
In the "name" field, type Terminal
In the "command" field, type gnome-terminal
Click "Add"
3- How to disable keyring in Ubuntu? [3]
Option 1: Disable Automatic Login
If you don’t have auto-login activated, the keyring is unlocked when you log in to your user account. Therefore, the system authenticates that you are the user and bypasses keyring prompt when you launch Chrome.
Option 2: Make Keyring password Blank
Step 1) Launch ‘Terminal’ and enter the following command. Elementary OS users may need to first enable PPA before attempting the below command. Ubuntu 17.10 comes with seahorse pre-installed, so you may see output that “seahorse is already the newest version…’.
sudo apt-get install seahorse
Step 2) After the installation is complete, launch “seahorse” from programs.
Step 3) Right-click on “Login” and select “Change Password”.
Step 4) Enter the old password when you see the pop-up. Then leave the new password field blank. Don’t enter even space. Click ‘Continue’.
Step 5) You should see an obvious warning pop-up that passwords will be unencrypted. Click ‘Continue’.
That’s it! Restart your computer for the setting to take effect. Next time you launch Chrome or Chromium browser, you should not see keyring request.
4- How to turn the system on automatically, after suddenly turning off?
Restart your system
Press F2, or F8, or Del to open the BIOS settings.
In the Advanced section, find APM
Make “Restore” on
-------------------------------------------------------------------
References:
[1] https://www.gabsoftware.com/tips/automatically-reconnect-to-your-vpn-on-linux/
[2] https://askubuntu.com/questions/308581/how-to-launch-terminal-on-login.
[3] https://www.fosslinux.com/2561/how-to-disable-keyring-in-ubuntu-elementary-os-and-linux-mint.htm