Ubuntu – How to disable the Terminal Emulator for certain users

gnome-terminalSecurityusers

How to prevent specific users from using the terminal emulator?!

I make a trick by writing a script in .bashrc which request a user to enter a password to be able to use the terminal emulator.

But this trick is not the perfect method for some advanced users who knows how to work over this trick.

For that, I'm seeking a method to prevent specific users from using terminal emulator at all, those users are just normal users without sudo permission.

Any suggestions?!

Best Answer

Create a group for users allowed to use terminals, let's say terminalusers. Find the terminal program (use which), for example, xterm. Change its ownership accordingly :

chown root:terminalusers /usr/bin/xterm

Allow execution for the owner, and the group. Deny for others :

chmod 750 /usr/bin/xterm

At this point, using xterm wont be possible unless you're root, or a member of the terminalusers group (add yourself to it, and you'll be able to use xterm). Apply similar settings for other terminal emulators (gnome-terminal is your main one I suppose). Now, this is just another trick : it blocks terminal emulators, not terminals (subtle difference indeed).

In a UNIX environment, terminals are the primary interfaces to the system. Blocking them is very likely to disturb many applications, not only command-line ones. Blocking terminal emulators instead is nothing but a workaround. With good permissions, remember that nothing bad can happen to your machine from a user terminal : it takes root privileges to mess things up.

Note : with xterm, this is said to cause problems with utmp.