Nixgeek

Random Ramblings

How to install RepoForge (formerly RPMForge) on CENTOS 7

As I get back into using CENTOS, I will be posting a few guides on various things I find. One of the first things is to install RepoForge (formerly RPMForge) to give a number of programs such as htop that I really missed.

So, to get started, download this rpm:

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

The next step is to install it:

rpm -ivh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

And finally, update yum

yum update

And the repo is now installed and updated, feel free to install any packages you need.

Quick password generator

Just a quick little password generator, since I’ve had a couple people ask. It will generate 12 character passwords using a-z, A-Z. 0-9 and various symbols such as _ and -

tr -dc a-zA-Z0-9_- < /dev/urandom | head -c 12 | xargs

Thats it, short and simple but effective.

How to delete an EFI partition in Windows

Just the other day I had to repartition an external drive that had an EFI partition on it. It took a few minutes to figure it out so I thought I’d leave this here for myself and anyone else that might stumble upon the post. Disclaimer of course is that please be sure on which disk and partition you are picking in the following steps so you don’t remove the wrong one and lose data.

Make sure the drive in question is connected and then:

Open a command prompt with elevated permission

Run diskpart

To see all of your disks, type list disk

To select the disk, select disk #

Then select the partition with select partition #

And the last command to run is delete partition override

Now you can close diskpart and the command prompt. The EFI partition is gone :)

Employee Survey

Dilbert

Interesting timing on this one as I just left a job like that around that time :)

Hack.me - Vulnerable web app community

Hack.me is a free community project where people can build, share & host vulnerable web apps to learn and experiment. Each app is sandboxed for you so you are somewhat safe (as safe as you can be on a site with people uploading strange things for security people to break anyway). You can also upload private images for self use. It looks liek a handy tool for anyone interested in learning more about security and penetration testing.

How to configure dropbox for multiple users on a headless Debian / Ubuntu server

There are numerous guides around to configure Dropbox on a headless Debian or Ubuntu server but it seems everytime I go to do one, I can’t find the nice guide I usually use or a website is down when I look for alternatives. So here is my quick guide for myself and anyone else that might stumble upon this page :)

For 32bit:

wget -O dropbox.tar.gz https://www.dropbox.com/download?plat=lnx.x86

tar xzf dropbox.tar.gz

./.dropbox-dist/dropboxd

For 64bit:

wget -O dropbox.tar.gz https://www.dropbox.com/download?plat=lnx.x86_64

tar xzf dropbox.tar.gz

./.dropbox-dist/dropboxd

At this point, dropbox will complain about not being linked to an account and output a web address to follow, do that and login to your account and it will be linked.

Kill the dropbox that you started manually (requires pgrep, if you don’t have it you can use your favorite method):

kill $(pgrep dropbox)

You can repeat the above steps for each user you want to have with their own dropbox.

For older versions of Debian pre-systemd: As root, either download this startup script or copy & paste the following code to /etc/init.d/dropbox and edit the DROPBOX_USERS line as needed:

# dropbox service
DROPBOX_USERS="user1 user2"

DAEMON=.dropbox-dist/dropboxd

start() {
    echo "Starting dropbox..."
    for dbuser in $DROPBOX_USERS; do
        HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
        if [ -x $HOMEDIR/$DAEMON ]; then
            HOME="$HOMEDIR" start-stop-daemon -b -o -c $dbuser -S -u $dbuser -x $HOMEDIR/$DAEMON
        fi
    done
}

stop() {
    echo "Stopping dropbox..."
    for dbuser in $DROPBOX_USERS; do
        HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
        if [ -x $HOMEDIR/$DAEMON ]; then
            start-stop-daemon -o -c $dbuser -K -u $dbuser -x $HOMEDIR/$DAEMON
        fi
    done
}

status() {
    for dbuser in $DROPBOX_USERS; do
        dbpid=`pgrep -u $dbuser dropbox`
        if [ -z $dbpid ] ; then
            echo "dropboxd for USER $dbuser: not running."
        else
            echo "dropboxd for USER $dbuser: running (pid $dbpid)"
        fi
    done
}


case "$1" in
  start)
    start
    ;;

  stop)
    stop
    ;;

  restart|reload|force-reload)
    stop
    start
    ;;

  status)
    status
    ;;

  *)
    echo "Usage: /etc/init.d/dropbox {start|stop|reload|force-reload|restart|status}"
    exit 1

esac

exit 0

After that, you need to make it executable and add it to system startup:

sudo chmod +x /etc/init.d/dropbox

sudo update-rc.d dropbox defaults

Repeat the starting, linking & killing steps above for all of the accounts you want to link. Once that is done run the dropbox init script you copied above:

sudo /etc/init.d/dropbox start

For newer Debian versions with systemd, create a file named /lib/systemd/system/dropbox@.service with the following content:

[Unit]
Description=Dropbox as a system service
After=local-fs.target network.target

[Service]
Type=simple
ExecStart=/usr/bin/env "/home/%i/.dropbox-dist/dropboxd"
Restart=on-failure
RestartSec=1
User=%i

[Install]
WantedBy=multi-user.target

After this, simply run

sudo systemctl enable dropbox@username

sudo systemctl start dropbox@username

And now you should be done. If you want to confirm that multiple dropbox accounts are running you can do:

ps aux | grep -i dropbox

Start the Windows Installer Service in Safe Mode with SafeMSI.exe

When a computer is in safe mode, the Windows Installer Service isn’t started. This can cause some issues as some malware can be removed easier through safe mode or maybe other issues in uninstalling a program force you to use an alternate method. However, if you just try to start the service in safe mode, it fails with an error message (Could not start the Windows Installer service on Local Computer. Error 1084: This service cannot be started in Safe Mode).

Enter SafeMSI.exe, a tiny (and portable) free app that starts up the Windows Installer Service for you. In reality, it’s simply running a registry tweak and starting the service but this makes it a lot easier than editing the registry & starting the service on your own.

You can download the program here