I stumbled upon this because I wanted to use my Raspberry Pi as a media device. (There'll be a great post on some ways to do that but I haven't figured out how I want to do it and gotten it to work yet.) Basically, my raspberry pi doesn't have enough room for all of my media. (mainly just music is all I was working with) and all of my music is on another computer on the network. I tried setting up an ftp server on that computer, which will work, I just didn't like it very much. Eventually I found sshfs which was great for what I wanted to do.
To install sshfs if you don't already have it. - on ubuntu/similar.
sudo apt-get install sshfs
If you have used ssh or scp then sshfs should be pretty simple It's set up like this:
sshfs [user@]host:[dir] mountpoint [options]
So, lets say I'm logged into my raspberry pi, and I want, let's say to be able to access all of my music from my desktop computer through a folder in my home directory(on my raspberry pi). My desktop is named sigsauer.
From my raspberry pi:
mkdir ~/Music/
(if it doesn't already exist)
then,
sshfs sigsauer:Music/ ~/Music/
One thing I learned at this point, is that when you install new system you need to remember to keep you /etc/hosts file up-to-date. Because if you don't you might run into problems when trying to use the computer name. Once I got past that little hangup, then things started to work perfectly.
Now I could go into my Music folder which I just created and access all of the files as if they were local.
This has been great for me since I have 2 computers and a raspberry pi, that stay at home and are always on the same network, I don't like having my music library all over the place, adding music here and there then making a mess when I try to compile it. Now I have everything reading off and editing the same library, making it much easier to keep my library organized.
One of the computers has ubuntu server on it and I didn't feel like dealing with installing dropbox on it, so I simply added a command to my crontab to mount the dropbox folder from my desktop computer to my server computer. More about crontab here.
Keep in mind that to add it to the crontab, since it can't ask you for a password you need to have passwordless ssh authentication. I have a little bit of instruction about how to do that which I may have to turn into a new post, but I found the easiest way for me is to simply copy the whole ~/.ssh/ folder from one computer to the other, then delete any offending keys from ~/.ssh/known_hosts file.
Once you are done with sshfs and don't need access to the files anymore, you can unmount the directory by simply:
fusermount -u <mount_point>
so to unmount my Music -
fusermount -u ~/Music/
And now if you went into the folder it should be empty.
This started as a place to write useful tricks with linux, mainly on the command line. Now lets just say it's another random tech blog.
Sunday, August 25, 2013
Wednesday, July 10, 2013
Adding cronjobs using crontab in Ubuntu 12.04/Mint 13
Cronjobs are a good way to run a script every so often (hour, day, week, at reboot, etc.) Some things I use it for are:
To keep my public ip address updated and saved in my Dropbox folder,
To mount my external hard drive on my ubuntu server every time it reboots,
And to update my psmouse-alps driver which needs to be updated at reboot as well.
I'm sure someone else can find many other possible more useful applications for this.
First think you need to do is find out what privileges you need to do what you want to do. Since all i need to update my public ip is access to the internet and also my dropbox folder, I only needed my regular user privileges.
Crontab has some pretty good explanations and even gives you an example in the comment in the file. The first 5 fields (separated by spaces) are to tell it when/how often you want to run a certain command/script. Right after the first five fields you just put the command/script you want to run.
The example used in the file:
0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
I found some pretty good examples to help you to understand the schedule notation that crontab uses. Wikipedia has a useful article here. Also this site was very useful. What I found was also very useful was some of the shortcuts, listed here.
They are:
To keep my public ip address updated and saved in my Dropbox folder,
To mount my external hard drive on my ubuntu server every time it reboots,
And to update my psmouse-alps driver which needs to be updated at reboot as well.
I'm sure someone else can find many other possible more useful applications for this.
First think you need to do is find out what privileges you need to do what you want to do. Since all i need to update my public ip is access to the internet and also my dropbox folder, I only needed my regular user privileges.
Crontab has some pretty good explanations and even gives you an example in the comment in the file. The first 5 fields (separated by spaces) are to tell it when/how often you want to run a certain command/script. Right after the first five fields you just put the command/script you want to run.
The example used in the file:
0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
I found some pretty good examples to help you to understand the schedule notation that crontab uses. Wikipedia has a useful article here. Also this site was very useful. What I found was also very useful was some of the shortcuts, listed here.
They are:
@reboot @yearly @annually @monthly @weekly @daily @midnight @hourly
So on my ubuntu server, since I need root privileges to mount my external drive, I edit the crontab by executing:
sudo crontab -e
Then I choose to edit it with vim since it is my preferred text editor, and add this line to have my external hard drive mount at boot:
@reboot mount -t ntfs-3g /dev/sdb1 /media/external
And to have my ip update every day I run:
crontab -e
(as a regular user, I don't need root for this)
and have it run my script to update the ip daily:
@daily /home/user/bin/ip_script
For any interested my script is very simple(3 lines), and only needs the curl utility installed.
sudo apt-get install curl
also dropbox if you don't already have it.
then open a text editor and write
#! /bin/bash
curl ifconfig.me >> public_ip
mv public_ip ~/Dropbox/
Then name and save the file, make it executable and add it to crontab.
Setting up opendns.com with Ubuntu 12.04/Mint 13
opendns.com is a great service for blocking and/or tracking web access. Although most people probably have a dynamic ip address, and it can be difficult to find a good way to keep your ip up to date with their site and servers. This is the way I found the easiest for me.
Go to www.opendns.com click on 'Sign In' in the top right corner. Then click on the Get Started! link and set up an account. I would suggest either of the free accounts. The only difference is that the FamilyShield account is preconfigured. I ended up configuring it myself anyway.
Then log in. Go to the Settings tab. Your own ip should be at the very top of the page(above the nav bar). You can use that to add your network. Once you have added your network you can click on your network/ip and set up your filtering preferences.
allowed on this network.
Now the way I chose to set my network up to go through the opendns servers was by configuring the ip addresses of the opendns servers on my router. This can be different depending on your router, mine was very simple. There was a place to specify static dns servers. I just entered the ip's (they can be found on the opendns website at the bottom of the page.) saved the configuration and all my web traffic was now going through the opendns servers.
Once you get to this point, if you try to visit a blocked site it should come up with an opendns site telling you the domain is blocked. If you have a static ip, then at this point you are done. Most of us I would imagine have a dynamic ip and need to set something up so that this will stay updated. I used DNS-O-Matic provided by same people who made opendns
Go to DNS-O-Matic website: http://www.dnsomatic.com/
Since it is an opendns service you don't need to create an account, you can use the one you just created with opendns.
Click on Sign In, use your opendsn username & password.
Click on the 'Add a service' button and select OpenDNS from the drop down list.
It will add the opendns service and then the status will be waiting for confirmation or something similar.
Now is the fun part. I found my preferred method to keep this up to date was by using ddclient. In a terminal type:
sudo apt-get install ddclient
It will then ask you a bunch of questions. I tried to match this as close as possible although, the questions and names for things are slightly different so it doesn't matter too much what you put in there since we will go to the config file and change it anyways.
After it is installed open up with sudo/root priviledges /etc/ddclient.conf in your favorite text editor. For me:
sudo vim /etc/ddclient.conf
and make it look like this.
The only unique change you need are your username and password, everything else you want to match the file in the previous link. Save the file and run: sudo ddclient
Now you can run ddclient every time your ip changes and it will keep everything updated or you can add it as a cron job, I would say once a day would be enough for most any isp. See how here.
Go to www.opendns.com click on 'Sign In' in the top right corner. Then click on the Get Started! link and set up an account. I would suggest either of the free accounts. The only difference is that the FamilyShield account is preconfigured. I ended up configuring it myself anyway.
Then log in. Go to the Settings tab. Your own ip should be at the very top of the page(above the nav bar). You can use that to add your network. Once you have added your network you can click on your network/ip and set up your filtering preferences.
allowed on this network.
Now the way I chose to set my network up to go through the opendns servers was by configuring the ip addresses of the opendns servers on my router. This can be different depending on your router, mine was very simple. There was a place to specify static dns servers. I just entered the ip's (they can be found on the opendns website at the bottom of the page.) saved the configuration and all my web traffic was now going through the opendns servers.
Once you get to this point, if you try to visit a blocked site it should come up with an opendns site telling you the domain is blocked. If you have a static ip, then at this point you are done. Most of us I would imagine have a dynamic ip and need to set something up so that this will stay updated. I used DNS-O-Matic provided by same people who made opendns
Go to DNS-O-Matic website: http://www.dnsomatic.com/
Since it is an opendns service you don't need to create an account, you can use the one you just created with opendns.
Click on Sign In, use your opendsn username & password.
Click on the 'Add a service' button and select OpenDNS from the drop down list.
It will add the opendns service and then the status will be waiting for confirmation or something similar.
Now is the fun part. I found my preferred method to keep this up to date was by using ddclient. In a terminal type:
sudo apt-get install ddclient
It will then ask you a bunch of questions. I tried to match this as close as possible although, the questions and names for things are slightly different so it doesn't matter too much what you put in there since we will go to the config file and change it anyways.
After it is installed open up with sudo/root priviledges /etc/ddclient.conf in your favorite text editor. For me:
sudo vim /etc/ddclient.conf
and make it look like this.
The only unique change you need are your username and password, everything else you want to match the file in the previous link. Save the file and run: sudo ddclient
Now you can run ddclient every time your ip changes and it will keep everything updated or you can add it as a cron job, I would say once a day would be enough for most any isp. See how here.
Tuesday, July 9, 2013
Regular things I do after a fresh install. (Ubuntu 12.04/Mint 13)
Here's some things I like to do after a fresh install of ubuntu/mint.
Install apt-fast:
sudo add-apt-repository ppa:apt-fast/stable
sudo apt-get update; sudo apt-get install apt-fast
Then update(I always use apt-fast since I know there will be a lot to download):
sudo apt-fast update; sudo apt-fast upgrade
Install vim from apt(if not already installed)
Edit my /etc/hosts file to include all of the computers on my home network. Copy over files that I backed up on those computers.
Disable apport(if ubuntu. if mint then disable after installing software-center):
sudo vim /etc/default/apport --- change '1' to '0' and save.
sudo service apport stop
Install chromium-browser use apt
Install chrome from .deb file
Install google-earth from .deb
Install google music manager from .deb
Install google talk plugin from .deb
Install teamviewer from .deb
Install VMware Player from .bundle (rename from .txt when saving(yes you can just still execute it regardless... just change it... because.))
Install synapse from apt
Install fogger:
sudo add-apt-repository ppa:loneowais/fogger
(update; and install fogger)
Install gimp if not at least 2.8(because I like the single window mode)
sudo add-apt-repository ppa:otto-kesselgulash/gimp
(update; and install gimp)
Install dropbox from apt
run/setup dropbox
Install apt-fast:
sudo add-apt-repository ppa:apt-fast/stable
sudo apt-get update; sudo apt-get install apt-fast
Then update(I always use apt-fast since I know there will be a lot to download):
sudo apt-fast update; sudo apt-fast upgrade
Install vim from apt(if not already installed)
Edit my /etc/hosts file to include all of the computers on my home network. Copy over files that I backed up on those computers.
Disable apport(if ubuntu. if mint then disable after installing software-center):
sudo vim /etc/default/apport --- change '1' to '0' and save.
sudo service apport stop
Install chromium-browser use apt
Install chrome from .deb file
Install google-earth from .deb
Install google music manager from .deb
Install google talk plugin from .deb
Install teamviewer from .deb
Install VMware Player from .bundle (rename from .txt when saving(yes you can just still execute it regardless... just change it... because.))
Install synapse from apt
Install fogger:
sudo add-apt-repository ppa:loneowais/fogger
(update; and install fogger)
Install gimp if not at least 2.8(because I like the single window mode)
sudo add-apt-repository ppa:otto-kesselgulash/gimp
(update; and install gimp)
Install dropbox from apt
run/setup dropbox
Tmux basics
Using tmux. What is tmux? How does it work and what's it useful for? Someone once recommended tmux as something useful to use. So I started looking into it without really knowing what it was. Here I'll tell you how it's actually useful to me. So, what is it? Here's what they have to say about it on sourceforge. "tmux is a terminal multiplexer. What is a terminal multiplexer? It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal. And do a lot more. See the manual."
Well that didn't make much sense to me and it took a bit of searching around and reading manuals and the like to find out how tmux would actually be useful to me.
For me tmux is pretty much just a way to run multiple terminals inside of one. Here's mine with 3 terminals open:
Well that didn't make much sense to me and it took a bit of searching around and reading manuals and the like to find out how tmux would actually be useful to me.
For me tmux is pretty much just a way to run multiple terminals inside of one. Here's mine with 3 terminals open:
It just looks like one of course(you can only type into one at a time). If you look at the green bar at the bottom you can see the names of each: 0:bash, 1:bash~, 2:bash*
So far this hasn't impressed me. I mean, that's just like having different tabs right? I can even do that with the terminal so that's not useful unless maybe I was on a server install. -- True. Where tmux really becomes useful is with it's ability to detach and attach sessions. I have 3-4 different computers(one isn't on too much) and I'm too lazy to get up and go to each computer when I find something cool that I want to install on all my computers, or when they all need to be updated. A lot of the time when I am at home it's not a problem to simply leave a terminal open connected to one of the computers via ssh while it installs something/updates/while running a script. Although if I decide I do want to get off my lazy but and go to one of the other computers(for instance from my laptop to my desktop) then I have to make sure the laptop stays up and running, or I have to kill the command and rerun it on the computer when I get there. If I am using tmux however I can simply detach the session, and reattach it when I get to the other computer.
Where I find I get the most use out of tmux is when I am connecting to a school server, or when I am connecting on my laptop from somewhere other than home. When connecting from somewhere other than home(and especially if I am installing something/running a script that will take a while I can't be sure that my in-laws internet will stay connected the whole time(if you look a the box(modem) wrong it disconnects). With tmux I can start apt-get then detach and it will be running in the background the whole time... and I don't need to be connected to that computer via ssh.
So now that I've bored you all with the usefulness of tmux for me, here's a few simple commands that I use that can hopefully get you started. If you start to find it useful and want to use it more I recommend going to one of the other sites out there to see more things you can do with it.
To start tmux simply type the command:
tmux
To open a new terminal instance:
Ctrl+b c
To close a terminal:
Ctrl+b x
To go to the next terminal:
Ctrl+b n
To detach the session:
Ctrl+b d
To reattach after detaching use command:
tmux attach
UPDATE: Wow I just realized this post is pretty long. For a crash course just install tmux and play with the above commands in the last paragraph. After learning and using tmux a bit more I'd say its time to add some more commands.
I simply looked at the man pages and created a cheat sheet of just the commands here.
Some of the main ones I'm using aside from the above are:
To split terminal vertically:
Ctrl+b %
To split horizontally:
Ctrl+b "
To navigate through existing panes:
Ctrl+b LEFT,RIGHT,UP,DOWN
Holding Ctrl+b down while using the navigation buttons will resize your current pane.
Saturday, June 29, 2013
Encryption using openssl
Inspired from a school assignment from http://cit.dixie.edu/it/2400/labs/security_lab.php
using openssl to encrypt a file. Don't know that this post really needs to be written since I found a very good howto at http://osxdaily.com/2012/01/30/encrypt-and-decrypt-files-with-openssl/ but I might as well give people another one.
openssl can be used on the command line to encrypt/decrypt different files. The command structure is something like this:
openssl [type of encryption to use] -in [input filename] -out [output filename]
Then if you would like to decrypt a file you just add the -d flag
openssl [type of encryption to use] -d -in [input filename] -out [output filename]
and then of course the input file would be the encrypted file, which would then output the plaintext (after you provide the correct passphrase/key)
I got curious about trying to make a tar.gz/bz2 file out of various files you would like to encrypt. I haven't tryed this on very large files, but I have read somewhere that it is not recommended and may not work. Although for throwing a few documents together, mainly text or maybe a few pics, it works fine. I actually learned a whole lot about shell scripting with this project. Here is the code:
########################
#! /bin/bash
USAGE=$'Usage: ./encrypt <output_filename> <file1> <file2> <...>\n-h\tshow help\n-o\toverwrite file\n-d\tdecrypt\n-v\tshow version'
FLAGS=()
FILES=()
FILENAME=()
if [ "$#" -lt 2 ]
then
echo "$USAGE"
exit 1
fi
for p in "$@"
do
if [ -f "$p" ]
then
FILES=( "${FILES[@]}" "$p" )
elif [ -d "$p" ]
then
FILES=( "${FILES[@]}" "$p" )
elif [ "${p:0:1}" == "-" ]
then
FLAGS=( "${FLAGS[@]}" "$p" )
else
FILENAME=( "${FILENAME[@]}" "$p" )
fi
done
len=${#FILENAME[*]}
if [ "$len" -gt 1 ]
then
echo "${FILENAME[@]}"
echo "Command not recognized: ${FILENAME[0]}"
echo "$USAGE"
exit 1
fi
OVERWRITE=0
DECRYPT=0
if [ ${#FLAGS[*]} -gt 0 ]
then
for flag in "$FLAGS"
do
if [ $flag == "-o" ]
then
OVERWRITE=1
elif [ $flag == "-d" ]
then
DECRYPT=1
elif [ "$flag" == "-h" ] || [ "$flag" == "--help" ]
then
echo "$USAGE"
exit 1
elif [ "$flag" == "-v" ]
then
echo "encrypt v1.0"
exit 1
else
echo "Flag not recognized: $flag"
echo "$USAGE"
exit 1
fi
done
fi
if [ $DECRYPT -eq 0 ]
then
tar cvjf ${FILENAME[0]}.tar.bz2 ${FILES[@]}
openssl enc -aes-256-cbc -salt -in ${FILENAME[0]}.tar.bz2 -out ${FILENAME[0]}
if [ $OVERWRITE -gt 0 ]
then
rm ${FILES[@]}
fi
rm ${FILENAME[0]}.tar.bz2
exit 1
fi
openssl enc -d -aes-256-cbc -in ${FILES[0]} -out ${FILENAME[0]}.tar.bz2
tar xvjf ${FILENAME[0]}.tar.bz2
rm ${FILENAME[0]}.tar.bz2
if [ $OVERWRITE -gt 0 ]
then
rm ${FILES[0]}
fi
#############################
using openssl to encrypt a file. Don't know that this post really needs to be written since I found a very good howto at http://osxdaily.com/2012/01/30/encrypt-and-decrypt-files-with-openssl/ but I might as well give people another one.
openssl can be used on the command line to encrypt/decrypt different files. The command structure is something like this:
openssl [type of encryption to use] -in [input filename] -out [output filename]
Then if you would like to decrypt a file you just add the -d flag
openssl [type of encryption to use] -d -in [input filename] -out [output filename]
and then of course the input file would be the encrypted file, which would then output the plaintext (after you provide the correct passphrase/key)
I got curious about trying to make a tar.gz/bz2 file out of various files you would like to encrypt. I haven't tryed this on very large files, but I have read somewhere that it is not recommended and may not work. Although for throwing a few documents together, mainly text or maybe a few pics, it works fine. I actually learned a whole lot about shell scripting with this project. Here is the code:
########################
#! /bin/bash
USAGE=$'Usage: ./encrypt <output_filename> <file1> <file2> <...>\n-h\tshow help\n-o\toverwrite file\n-d\tdecrypt\n-v\tshow version'
FLAGS=()
FILES=()
FILENAME=()
if [ "$#" -lt 2 ]
then
echo "$USAGE"
exit 1
fi
for p in "$@"
do
if [ -f "$p" ]
then
FILES=( "${FILES[@]}" "$p" )
elif [ -d "$p" ]
then
FILES=( "${FILES[@]}" "$p" )
elif [ "${p:0:1}" == "-" ]
then
FLAGS=( "${FLAGS[@]}" "$p" )
else
FILENAME=( "${FILENAME[@]}" "$p" )
fi
done
len=${#FILENAME[*]}
if [ "$len" -gt 1 ]
then
echo "${FILENAME[@]}"
echo "Command not recognized: ${FILENAME[0]}"
echo "$USAGE"
exit 1
fi
OVERWRITE=0
DECRYPT=0
if [ ${#FLAGS[*]} -gt 0 ]
then
for flag in "$FLAGS"
do
if [ $flag == "-o" ]
then
OVERWRITE=1
elif [ $flag == "-d" ]
then
DECRYPT=1
elif [ "$flag" == "-h" ] || [ "$flag" == "--help" ]
then
echo "$USAGE"
exit 1
elif [ "$flag" == "-v" ]
then
echo "encrypt v1.0"
exit 1
else
echo "Flag not recognized: $flag"
echo "$USAGE"
exit 1
fi
done
fi
if [ $DECRYPT -eq 0 ]
then
tar cvjf ${FILENAME[0]}.tar.bz2 ${FILES[@]}
openssl enc -aes-256-cbc -salt -in ${FILENAME[0]}.tar.bz2 -out ${FILENAME[0]}
if [ $OVERWRITE -gt 0 ]
then
rm ${FILES[@]}
fi
rm ${FILENAME[0]}.tar.bz2
exit 1
fi
openssl enc -d -aes-256-cbc -in ${FILES[0]} -out ${FILENAME[0]}.tar.bz2
tar xvjf ${FILENAME[0]}.tar.bz2
rm ${FILENAME[0]}.tar.bz2
if [ $OVERWRITE -gt 0 ]
then
rm ${FILES[0]}
fi
#############################
This can also be used to decrypt the file. I used aes-256 encryption because it seemed to be one of the most secure. Most of the code is probably for processing the command line flags, the actual code to create a tar.bz2 and encrypt it is pretty simple. This is probably about as far as I got in working with openssl. I am fascinated by cryptography and encryption, but don't really have much use for it(yet).
Controlling VLC remotely. (using vlc on ubuntu 12.10 and remote for vlc on android, or a web browser)
This is simply another resource for anyone wanting to remote control vlc on their computer. Some of the info I got from here. And some from various other blogs/articles about the same thing. First things first.. you need to have vlc installed. Use "sudo apt-get install vlc" to install it if you don't have it already. While most of the sites I've seen have shown you how to enable vlc's web interface from the gui program, for using this as more of something like a daemon/service, I personally have found it much more useful to just have it run in the background since when you close the gui it stops the service as well. Press Alt-F2 to open up the run dialog and simply type:
vlc -I http
which just starts the vlc web (or http) interface. At this point you can access this interface by opening a browser and typing "localhost:8080" in the location entry.
You can control and use vlc from here. Although this isn't particularly useful at this point since I can do everything this interface does and more by just opening up the vlc gui. To be able to control vlc remotely, you're going to need to edit a few lines of a file. It is most likely located here: /usr/share/vlc/lua/http/.hosts
Now, using vim(or another preffered text editor), and as root(or with sudo privileges) open the file:
vim /usr/share/vlc/lua/http/.hosts
There should be a private addresses section that is all commented out. If your network is like mine and the ip addresses of all your computers are 192.168.x.x, then uncomment the line with 192.168.0.0/16. If the ip addresses on your network don't look like mine then find the line that looks like your ip and uncomment the corresponding line. Also, another option is that if you know the ip(s) of the device(s) you will be using to control vlc you can simply add it/them to the file(right after the private addresses section is fine).
The reason for all of this is that by default vlc's web interface is only accessible from localhost, or the same computer you're running it on. (which isn't very useful)
Once you have this set up you should be able to connect and control it from another device. If you are trying to access it from another computer just open up a web browser and type in http://192.168.x.x:8080 (replacing the ip address with the address of the computer you have the vlc server running on). You should get the same interface as earlier.
Controlling it from another computer can be useful, but I find it even more useful to be able to control vlc from my android smartphone. I used Remote for VLC by Peter Baldwin. Available in the play store(free). There are various others and I tried most of them, but this one seemed to be the most stable and I liked the setup the best. To connect to your computer with your phone, start the Remote for VLC app. If it doesn't automatically give you the option to add a server then go to the settings:
Click on 'Add VLC server' then enter the ip address of your computer, then type 8080 into the port(unless you specified a different port). It will connect and you can then search your music library via the 'Library' tab (it is more of a file explorer). Find the song or folder you would like to play
vlc -I http
which just starts the vlc web (or http) interface. At this point you can access this interface by opening a browser and typing "localhost:8080" in the location entry.
You can control and use vlc from here. Although this isn't particularly useful at this point since I can do everything this interface does and more by just opening up the vlc gui. To be able to control vlc remotely, you're going to need to edit a few lines of a file. It is most likely located here: /usr/share/vlc/lua/http/.hosts
Now, using vim(or another preffered text editor), and as root(or with sudo privileges) open the file:
vim /usr/share/vlc/lua/http/.hosts
There should be a private addresses section that is all commented out. If your network is like mine and the ip addresses of all your computers are 192.168.x.x, then uncomment the line with 192.168.0.0/16. If the ip addresses on your network don't look like mine then find the line that looks like your ip and uncomment the corresponding line. Also, another option is that if you know the ip(s) of the device(s) you will be using to control vlc you can simply add it/them to the file(right after the private addresses section is fine).
The reason for all of this is that by default vlc's web interface is only accessible from localhost, or the same computer you're running it on. (which isn't very useful)
Once you have this set up you should be able to connect and control it from another device. If you are trying to access it from another computer just open up a web browser and type in http://192.168.x.x:8080 (replacing the ip address with the address of the computer you have the vlc server running on). You should get the same interface as earlier.
Controlling it from another computer can be useful, but I find it even more useful to be able to control vlc from my android smartphone. I used Remote for VLC by Peter Baldwin. Available in the play store(free). There are various others and I tried most of them, but this one seemed to be the most stable and I liked the setup the best. To connect to your computer with your phone, start the Remote for VLC app. If it doesn't automatically give you the option to add a server then go to the settings:
Click on 'Add VLC server' then enter the ip address of your computer, then type 8080 into the port(unless you specified a different port). It will connect and you can then search your music library via the 'Library' tab (it is more of a file explorer). Find the song or folder you would like to play
After selecting Play or clicking on the mp3 go to the 'Playing' tab. There you can use the media controls. For some reason the playlist just shows about all of your music, and you can't really just clear it when you want to play something else which is for me the only real downside of this app.(but I still chose it because it worked the best for me for what I wanted to do)
Subscribe to:
Posts (Atom)