Thursday, March 30, 2017

Pianobar.. Pandora for the Command-Line

First off I love this package!!  Not only is it cli -based, which is my 'deal' these days.  But it lets me skip songs, shelve them for a month, choose and create new stations... plus it does not time out asking if I'm still there.

https://github.com/PromyLOPh/pianobar  clone this guy down locally and get to listening to your favorite music!


Friday, March 10, 2017

BASH: change ownership of subfolders based on parent folder name

Sounds convoluted, and honestly I felt overwhelmed trying to figure out how to handle this programmatically.

So for the past few days I've been working on a new Cent7 server to replace an aged 6.6 vm.  This box sits in the DMZ and is used by various entities around the state to sftp certain txt files to.  So there are roughly 50 home directories.. each with sub folders and an ssh key.  So in an effort to *not* force the users to create new ssh keys I rsync'd the entire parent folder over.  First time I lacked the proper permissions and wound up creating the home folders but nothing underneath.

So long story short, I eventually was able to get the correct syntax down to rsync the /chroot/parent and all the individual home sub-folders to the new server WITH the two sub folders and the .ssh(which houses the authorized_key file).  EUREKA!

However now all the permissions were borked up.  My own local ssh user had taken ownership of the parents, and children in both user and group. DOH!  I was able to clean up the group side of things easily enough via: 'chown -R :group /*'  However the user side was trickier because the user side on the two sub folders needed to be owned by the user in question.  (Obviously) but luckily enough for me the home folder's names was the username entirely.  Lucked into this absolute gem:

Fix the path in Line 1, and you are golden!


for dir in /home/*/; do
    # strip trailing slash
    homedir="${dir%/}"
    # strip all chars up to and including the last slash
    username="${homedir##*/}"

    case $username in
    *.*) continue ;; # skip name with a dot in it
    esac

    chown -R "$username" "$dir"
done

Thursday, March 2, 2017

Fedora 25, Another Shot at a Linux Workstation - UPDATE #2

So a while back I posted complaints about DisplayLink and their (so far) unwillingness to offer up Linux drivers for distros other than Ubuntu.
Since then I have discovered that USB-C docks that utilize DisplayLink seem to work right out of the box.  Display, Ethernet, and usb-passthrough all work perfectly.

So the current plans are, once I'm satisfied that I can perform all my normal functions at work using Fedora and a Win10 vm, connect to all three VPN tunnels in both OS's and access all the files I need then it's time to acquire a dock.

:happy dance: