Begone Caps Lock and Other Great Keyboard Hacks - page 2
Begone, Vile Caps Lock!
Figuring Out Commands
The tricky bit with xbindkeys-config is knowing the correct application launching commands. The simplest command is the program's name with no options, like kate or gimp or firefox. (Shame on Linux distributions and desktop environments that obscure the real application names - users will not faint at the sight of useful information.) Anything that works on the command line will work in xbindkeys-config. For launching graphical applications with rootly powers, or as any other user, you need gksu or kdesu. Using one of these gives you a graphical login window, like Figure 2.
Ubuntu, sudo, and Root
su is "switch to a different user". sudo is "execute a single command as another user, as configured in the /etc/sudoers file." Ubuntu's clever use of sudo is one of those "d'oh! Why didn't someone think of this years ago!" deals. Users who need occasional root privileges are simply added to the admin group. sudo protects the root password and logs all activity. Ubuntu doesn't even create a root login during installation. But you really need a root login for a number of reasons: some commands do not know how to handle it when sudo asks for a password, and it's more convenient when you have a lot of administrative chores to perform. Probably the most important reason to have a root login is the Ext2/3 filesystem reserves 5% of the filesystem for the root user. This gives you enough room to manuever and to rescue the system when some user process goes nuts and fills up your hard drive.
How do you make a root login on Ubuntu and all of its Buntu cousins? Easy, with sudo:
$ sudo passwd root
sudo is typically compiled with a 15-minute timeout, which means you can run a number of sudo commands without re-entering your password in that time. You can this change per-user or per-group by editing /etc/sudoers, which must be done with visudo:
$ sudo visudo $ Defaults:carla timestamp_timeout=30
Close and save with Ctrl-X and Y. -1 makes it infinite. Don't do this, for obvious security reasons.
Because Ubuntu makes gksu and gksudo both behave like sudo, how do you configure xbindkeys to run a command as "real" root? Use the -w switch, like this:
$ gksu -w kate
You can cancel the sudo timeout with this command:
$ sudo -k
This is helpful when you're testing your commands and they get stuck in sudo mode.
kdesu is a front-end to su, and by default switches to the "real" root user. So you need a root login on your system to use kdesu, like this:
$ kdesu kate
You may also switch to any user that you know the password for:
$ kdesu -u pinball kate
Come back next week to learn more about using xbindkeys with lots of nice examples, and a quick tour of KeyTouch for additional useful customizations to your multimedia keyboard.
- man 1 xmodmap
- man 5 sudoers
- man 1 gksu
- man 1 kdesu
- man 1 xbindkeys
Article courtesy of Enterprise Networking Planet, originally published July 9, 2007
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 2Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 3Linux Top 3: Debian Dumps SPARC, Ubuntu Takes Over Linux 3.13 and the Core Infrastructure Initiative
- 4Linux Top 3: Fedora, Ubuntu and Gluster Lose Community Leaders
- 5Red Hat Enterprise Linux 7 Finally Hits the Big Time