Did you ever come across a situation where you want no one to access your Ubuntu’s Terminal, except you? Locking the screen is one thing you can do, but for whatever reason you chose to allow a person to use your PC, but you wouldn’t like him/her to use the most crucial part of Linux system, the Terminal.

I don’t doubt the idea. Here is a guide on how to password protect the Terminal. Note that I’m not talking about the root password that is needed to execute any admin privilege commands with in the Terminal, but my intent is, a user will not be able to even see the Terminal interface itself without entering the root password.

Password Protecting Ubuntu Terminal

This guide is tested on Ubuntu 17.10, but should work on Ubuntu 16.04, 16.10, Linux Mint, and elementary OS.

Step 1) Launch ‘Terminal’.

Step 2) Go to “Edit” > “Profile Preferences”.

Profile Preferences
Profile Preferences

Step 3) Click “Command” tab.

Step 4) Check the box “Run a custom command instead of my shell” and enter su username in the box. For example in my case it’s going to be su kiran as shown in below screenshot.

Enter custom command to lock Terminal
Enter custom command to lock Terminal

Step 5) In the section “When command exits:”, you will see three options on what will happen if a user enters wrong password. You can select “Exit the terminal”. In this case, the Terminal will simply quit upon entering incorrect password without warning. You can also select “Restart the command” which will make Terminal to show “Authentication failure” error and lets user to reenter password. In this example, I chose “Restart the command” option.

Incorrect Password enter Options
Incorrect Password enter Options

Step 5) Click “Close”.

Step 6) Try to launch Terminal now. It will ask for password and won’t show the Terminal prompt without entering the correct password.

Terminal Password Protected
Terminal Password Protected

Hope you find this guide useful. Have a good one guys!

Previous articleHow to refresh desktop in Ubuntu without rebooting PC
Next articleHow to Enable Tabs in Ubuntu Terminal
Hi there! I'm Kiran Kumar, founder of FOSSLinux.com. I'm an avid Linux lover, and enjoys hands-on with new promising distros. Currently, I'm using Ubuntu as a daily driver and run several other distros such as Fedora, Solus, Manjaro, Debian, and some new ones on my test PC and virtual machines. I have a day job as an Engineer, and this website is one of my favorite past time activities especially during Winter ;). When I'm not writing for FOSSLinux, I'm seen biking and hiking on scenic trails. Hope you enjoy using this website as much as I do writing for it. Feedback from readers is something that inspires me to do more, and spread Linux love!. If you find time, drop me an email or feedback from 'Contact' page. Or simply leave a comment below if you found this article useful. Have a good day!

Leave a Reply

Be the First to Comment!

avatar
  Subscribe  
Notify of