Pages - Menu

Thursday, April 26, 2012

su to root without a password

I'm sick of typing the root password every time I want to su - on Fedora to become the root user. I know how to allow sudo access without a password, but I don't want to use sudo, I want to be able to just type su - and become root.

I couldn't find a good answer for this on Google, so I read the man pages of pam (Pluggable Authentication Modules) until I figured it out.

In the file /etc/pam.d/su put this as the second line:

auth            sufficient

This is incredibly insecure as it lets literally anyone at all with a login become root.

To restrict this just to your username, use this line instead, replace the yourusername with your actual username:

auth            sufficient use_uid user = yourusername

You can also restrict this to a group, here the group allowedpeople can su without a password:

auth            sufficient use_uid user ingroup allowedpeople

Saturday, April 21, 2012

starting rtorrent on system startup

rTorrent is a curses-based bittorrent client for Linux.

It's very light on system resources but has great features such as monitoring of a directory for .torrent files, auto-move based on status (incoming, seeding, complete, etc), categories, magnet link handling and RSS capabilities.

I have a headless system where I seed some (legal) torrents and wanted rTorrent to start up when the system did. There are some examples of init scripts on the rTorrent site but I didn't like how these ran, specifically the su constantly needing a password and the odd way it started GNU Screen.

  • Put it at /etc/init.d/bittorrent and make it executable
    chmod +x /etc/init.d/bittorrent
  • Add to chkconfig
    chkconfig --add bittorrent
  • Set to start on system startup
    chkconfig bittorrent on
  • If you want non-root users to be able to control it, put this in your visudo, replace "username" with your non-priveledged username
    username localhost=NOPASSWD:/etc/init.d/bittorrent*
  • Setup an alias to the script in the user's ~/.bashrc
    alias bittorrent='/etc/init.d/bittorrent'
    alias bt='bittorrent'
  • CentOS 6 or Fedora 12-14. Probably also works on CentOS 5.
  • screen and rtorrent
  • A non-priveledged user to run rtorrent, this can either be a new user just to run torrents, or an existing user
  • Absolute session path in the .rtorrent.rc file
    session = /home/rtorrent/.session  ## this is good
    session = ~/.session               ## this will break
    session = .session                 ## so will this
  • Paths for other actions such as monitoring directories for .torrent files and auto-moving complete downloads don't have to be absolute.
  • Control the daemon withbittorrent start, bittorent stop, bittorrent restart
  • Get information about the daemon with
    bittorrent status, bittorrent info
  • Connect to the screen session with
    bittorrent connect
    (press ctrl+a then d to disconnect)

starting minecraft server on system startup

This is an initscript to run a Minecraft or CraftBukkit server on CentOS, Fedora, and Ubuntu.

  • Start, stop, restart CraftBukkit as a system service
  • Automatic (via cron) and manual logfile rotation
  • Automatic (via cron) and manual backups
  • Backup compression and rotation (keeps 7 days worth of backups)
  • Check latest Recommended Build and update to it if required
  • Information display including Java path, current memory usage, current TCP connections
  • Able to run multiple separate instances of the server at once
Supported Distributions
  • CentOS 6, CentOS 5, Fedora 14
    (probably works on Fedora Core 6 and later, untested)
  • Ubuntu Server 12.04 LTS
Other distros which use SysV Init or Upstart (Debian, Mint) will probably work.
Distros using systemd (Fedora 15+, Arch Linux, etc) will not work.

Get the script, view Requirements, Installation, Backups, Multiple Instances, and Usage

Released under GNU GPL v3 -


Thanks to these people whose work I have used in the making of this

The State of the Linux

It's been a while since I've posted but I'm still around. I started this blog as a sharing of tips and fixes I which used and couldn't find anywhere else. I've easily found most things I've wanted to do in the last few years so I haven't had the need to make much noise.

Today I'm here to write about the state of desktop Linux as I see it, compared to when this blog started in 2008 and I was obviously using Ubuntu.

These days I am a Fedora user. This was mostly brought about by starting to use RHEL at work and the need to become familiar with regular use of the RPM-based distro. I've also changed all my own servers over to CentOS.

Fedora's okay. Some people may deny this, but I think it's obviously a dumping ground for features Red Hat want to try, or to have the Fedora community crowdsource most of the initial testing and bugfixing before doing their own QA for inclusion in RHEL.

Fedora's near-bleeding-edge package cycles, still with a focus on stability, is both its strength and its weakness. It's great having the kernel or Wine updated in-distro within a week of new major upstream releases. It's frustrating having to deal with "latest and greatest" features I dislike such as GNOME 3 and systemd. I generally find Yum/rpm to be greatly messy and inferior compared to apt.

GNOME 3 is probably the largest thing to happen to desktop Linux in the last few years. It was met with such a hugely negative response and such polarising opinions that sites are still running polls about it. I think the developers made a mistake, sticking their head in the sand and telling users that the forced paradigm shift to Gnome Shell was what they wanted, despite the fact many people said they didn't.

Many Linux users appear to be seeking alternatives to Gnome Shell and all the competing Desktop Environments (KDE, XFCE, LXDE) have probably seen an increase in user base. Linux Mint listened to their users and pursued the MATE fork of GNOME 2, then created the Cinnamon Desktop. This fulfilling of majority demand has pushed them to the top of Distrowatch and kept them there. Kudos to the Mint Team for putting their money where their mouth is.

Ubuntu chose Unity over Gnome Shell. I've tried Unity several times and have been disgusted by it. It's so un-useable that I consider it just plain broken. I think it's pushing Ubuntu into irrelevance and their declining rating on Distrowatch tends to agree.

Mint used to be based on Ubuntu and have now started offering a re-base on Debian. CrunchBang also used to be based on Ubuntu and has switched to Debian altogether. Ubuntu's own variants Kubuntu and Xubuntu have fallen from sponsored releases to just "officially recognised" community projects.

I considered Ubuntu to be the king of Linux distros for a long time, but its reign is now well and truly over.

One interesting distro I saw on a magazine is Fuduntu. The name is ridiculous but the product itself is worth a look. It's a fork of Fedora 14 which has gone rolling-release. It still runs GTK2 and SysV Init but incorporates the latest 3.x kernel series. It has a smaller package set than Fedora and runs a Mac-like desktop environment based around a top-of-screen Gnome Panel and Avant Window Navigator.

My own desktop these days is Openbox with tint2 panel, a minimalist throwback from my days as an Arch Linux user.

Arch itself is a good distro with a great community, full of positive helpful people, few (if any) jerks, and little politics. However, I found myself spending around a quarter of my computer time just maintaining my system, rather than using the computer to do other things. Arch is something all Linux enthusiasts should do once for a period of time, the amount of tinkering and low-level micro-management required is educational and improves your Linux skills, but I feel it also is very much "using Linux for the sake of using Linux".

There seems to be a big paradigm shift happening all over desktops these days. Unity and GNOME 3 led for Linux and seem to have failed, Microsoft have shown their Metro interface which must be a bad joke. It's as if the development world has suddenly and unanimously decided the "menu and taskbar" interface which began with Windows 95 is no longer good enough, but nobody's come up with a suitable replacement, except perhaps Cinnamon.

Which desktop eventually wins out is still anyone's guess. Mint has shown that it's not necessarily the big corporate-backed developers who set the trend. Maybe we will never see one true new standard environment and modular personalised DEs will be the order of the day.