Here is a small Bash script that converts any supported ffmpeg video format; such as .MKV, .MP4 or .MOV and extracts the audio to an .MP3 file, It will also split that MP3 file into chunks and put them in a convenient directory. You will need to install ffmpeg and mp3splt for your particular platform.
./mkv2mp3"big fat file.mkv"
This uses ffmpeg to convert “big fat file.mkv” to “big fat file.mp3” and then uses mp3splt to create a directory “big fat file” containing the files 01 – big fat file.mp3, 02 – big fat file.mp3, etc. The MP3 files will be encoded at 128k Constant Bit Rate and each file will be around 50 minutes in length. To install in Debian/Ubuntu use: sudo apt-get install ffmpeg mp3splt
Taking this further, I was thinking that it would be nice to have these converted into the M4B Audiobook format for use on my elderly iPod. The script below assumes that you have processed the files as above and have added metadata tags using a tool like mp3tag (yes I know this is for Windows).
To complete this we need to: Combine the multiple MP3 files into one big file, or read the original big file then convert that to M4B format at 96K bit and add chapter marks every ten minutes. For this I have used ffmpeg v3.2.12 and libmp4v2 (for the mp4chaps utility), to install in Debian/Ubuntu use: sudo apt-get install libmp4v2-dev mp4v2-utils ffmpeg
This script works best from a single MP3 file rather than from those that have been re-combined back into a single file, recombining the files caused ffmpeg to exclaim “invalid packet size” and “invalid data” errors. It is able to tell the difference between a directory and a single MP3 and processes the file accordingly, don’t forget to add metadata tags and cover art before you run the script.
## get the tag text from the metadata
## if the line contains an equals (=) then split by the first equals.
## check if input is a diretory
# get the name of the first MP3 file in the directory
Bluetooth Low Energy – BLE – Bluetooth 4.0 is an industry-standard wireless protocol built for the Internet of Things – IoT, it is designed to provide connectivity for devices operating from low capacity power sources such as coin cell batteries.
In this introduction to BLE I’ll be configuring a Raspberry Pi2 computer to talk to a smart watch. We will be installing the latest version of BlueZ from source, enabling BLE support. This is not a tutorial on decoding the data from the watch I am just using it as an example, although I may write about decoding it in a future posting.
I am using a ASUS USB-BT400 Bluetooth 4.0 Dongle on a Raspberry Pi2 but this will work on any computer with a Debian based distribution. Your dongle must be BLE/Bluetooth 4.0 capable otherwise this won’t work. I am using an ID107HR activity tracker with pedometer and heart rate monitor, randomly chosen from the list of cheap ones available on Amazon. While using the Pi to talk to the the watch make sure Bluetooth on the phone is off as it can only connect to one device at a time.
The current distribution of Raspbian – jessie on the Raspberry Pi comes with version 5.23 of the BlueZ Bluetooth stack that’s rather old, dating from September 2014 which lacks many of the features we will be needing. The current version 5.44 of the BlueZ has many changes in the package with many familiar components such as hcitool and gatttool being depreciated, so I will be ignoring those and using the available commands, bluetoothctl, on the terminal.
With Raspbian – jessie installed we will need to update the Pi make sure some packages are installed and then installing the latest version of BlueZ. But first, remove the installed version 5.23 of BlueZ:
removing the installed bluez
$sudo apt-get--purge remove bluez
$sudo apt-get autoremove
Next, perform the traditional housekeeping updates then install the build tools and USB libraries. Those parts that are installed already will be automatically skipped.
Inside the BlueZ directory, configure, make (this takes a while), and install. The experimental option adds BLE support and enabling the library allows for python use later on:
$sudo make install
Configuring and Starting BlueZ
At this stage we will need to check that the installation worked and that we can see your bluetooth dongle. With your bluetooth dongle in a USB port you should see it on your list of USB devices, here you see mine as device ID: 0b05:17cb ASUSTek Computer, Inc.:
Bus001Device003:ID0424:ec00 Standard Microsystems Corp.SMSC9512/9514Fast Ethernet Adapter
bluetoothctl remembers your devices, so when you next use the program the watch appears on the list at the start. The controller has a number of options, these can be seen with help command. You can use show to view the status of your dongle:
UUID:A/VRemote Control Target(0000110c-0000-1000-8000-00805f9b34fb)
The list of UUID’s show the services supported by the Dongle. Now we can power the dongle on, set the agent – this manages the connection, and then connect to the watch on which the bluetooth symbol will appear. Once connected there will be a pause then you will see a list of attributes supported by the watch, it is advertising the services available:
These UUID’s are used to describe the sevices available on the device, some are pre-defined and can be found in the a href=”https://www.bluetooth.com/specifications/gatt/characteristics” target=”_blank” rel=”noopener noreferrer”>GATT schema, others are vendor specific and unless they publicly release these, decoding can become rather difficult. There are four types of attribute:
Services – collections of characteristics and relationships to other services that encapsulate the behavior of part of a device
Characteristics – attribute types that contain a single logical value
Descriptors – defined attributes that describe a characteristic value
Declarations – defined GATT profile attribute types
Each attribute is identified by a 128 bit ID, for example, one of the characteristics from the list above: 00002902-0000-1000-8000-00805f9b34fb, the first eight bits are used as an unique identifier: 00002902 and are shown as UUID’s: 0x2902. Data is contained in services, each service has a number of characteristics that may contain further descriptions depending on the requirement of the characteristic. You can see how the data is mapped out in this chart:
A spreadsheet with the watch data reformatted and tastefully coloured to illustrates this. Observe the Service URL column, it looks a lot like a directory structure:
Here we see two services /service0008 and /service000c looking further into the second service: /service000c we see that it has four characteristics, and to of those have descriptors. We can interrogate the characteristics and descriptors to glean further information by selecting the attribute and reading, like so:
Which is all very nice, but not particularly helpful as the manufacturer has chosen to use custom, proprietary, UUID’s for the watch. We don’t know the instructions to send to have the watch realease its data.
Those Scripting BlueZ
Inevitably, you’ll be wanting to automate connections. This becomes easy with the automation scripting language expect. Install, then make a script file:
$sudo apt-get install expect
In this example the script forgets the watch, finds the watch, connects to the watch, gets some info and then disconnects:
## execute blutetoothctl
spawn sudo bluetoothctl
## forget about the device - if connected previously
## switch on the dongle
expect"Changing power on succeeded"
## scan for devices
## set the agent
## connect to watch
## get some info
in the script, send sends a command, don’t forget to add the carriage return – \r and expect is used to wait for a response within the timeout period, here it is set to 10 seconds. expect -re is using regex when looking for a reply, otherwise it uses a literal string. So much more can be done with expect and there are many tutorials, such as this one written by FluidBank.
More Bluetooth Data
For analysing bluetooth data a couple of very useful tools are available, Wireshark and Android data logging. I will go through the installation but not look at the data in any detail, this posting is getting a bit long. This Section is in two parts, installing Wireshark and Android Debug Bridge.
Sniffing with the Shark
Wireshark is a network and bluetooth packet sniffer, it shows you network and bluetooth traffic occurring on your Pi. Here is a quick installation method for a reasonably new version of Wireshark (v2.2.4) from the backports, answer yes to the question “Should non-superusers be able to capture packets?”:
and if you get a message about permissions, reconfigure the package and answer yes:
$sudo dpkg-reconfigure wireshark-common
Start Wireshark and double click your bluetooth device on the list, in my case bluetooth0. There is not much to see as Wireshark will only see traffic between the watch and the Pi:
Android Debug Bridge – ADB
For Anroid 4.2.2 and above, activate developer mode on the phone, go to Settings, tap About Phone and at the bottom of the list tap Build Number three times. Back in the main settings page Developer Options has appeared, tap developer and turn USB debugging On. With the phone plugged into a USB port a little Android head should appear in the information bar at the top-left of the screen. To begin we will need to install some udev rules written by Nicolas Bernaerts:
At this point on the phone an allow USB debugging dialog will appear, give permission and always trust to authorise it. ADB will now show the device as a device:
android tools install
List of devices attached
If the device list is empty, with everything plugged in good and proper and the phone setup in developer mode, start your diagnosis by checking udev; open another terminal window and view logging with udevadm monitor –environment and reload with sudo udevadm control –reload I’m not entirely sure what I did to get it from ‘not working’ to ‘working’. If all else fails elevate yourself to root.
With ADB now setup we can capture the Bluetooth data being exchanged. With bluetooth off, in the Developer Settings find Enable Bluetooth HCI snoop log and turn it On. In the smartwatch app synchronise with your watch, once complete turn Bluetooth off manually – this is to minimise the amount of captured data. Don’t forget to turn logging off on the phone when done. To find where the log file has been stored and copy the file from the phone to the Pi use:
This wasn’t quite the posting I originally had in mind, I wanted to decode the data from the watch for my own use, making something more useful, impressive graphs and charts, than that provided by the Android App VeryFit 2.0 but as the manufacturer has chosen to use proprietary GATT codes it makes the job that much harder. It may be much simpler to just buy an expensive FitBit and download the data from them. But with writing this I now know a few things that were previously unknown, and I hope that this has provided some light to your BlueZ (a pun!, right at the end!).
Update: 15 April 2016 – Added information about which IP address to use and assigning static IP addresses for printers and servers
Recently I have needed to find an emergency alternative to my broadband due to the regional wide area network, Digital Region, being shut down, and the ISP Origin making a mess of getting all their cutomers onto ASDL. To get quickly back onto the internet, I have bought an ZTE MF823 4G Mobile Broadband Dongle as supplied by the badly named ‘three’ mobile phone company. As I have my own internal wired network, with multiple computers and ‘things’ there is a need to have something more sophisticated than just plugging the dongle into a single PC.
Here is my recipe for setting up a Raspberry Pi as a router with an ZTE MF283 Dongle. In this setup all the computers are on a wired Ethernet connection using a switch for the network. The Pi has Raspbian Debian Wheezy installed (June 2014) with all the latest updates made. For testing, the dongle is plugged into the USB port via a powered hub, and the Pi connected to a switch with another PC running Linux Mint.
Which IP addresses to use?
In this How-To I am using the IP address range 192.168.2.xxx this is to avoid conflict with the cable router which uses the 192.168.1.xxx range (the DHCP server is switched off on the router). IPv4 addresses are split into three different ranges, the 192.168.xxx.xxx range – 192.168.0.0 to 192.168.255.255 gives a possible 65,536 addresses but for your home it is unlikely you’ll have more than 255 network devices, so we can simplify things by limiting the address range used to 192.168.2.xxx and avoid the troublesome world of subnet masking.
192.168.xxx.xxx is used as its been designated for use on private networks by the Internet Assigned Numbers Authority this is a well established convention and is best practice. Two other IPv4 address ranges are available for larger private networks: 172.16.0.0-172.31.255.255 and 10.0.0.0-10.255.255.255 with 1,048,576 and 16,777,216 available addresses respectively, the most suitable network class should be chosen for your network.
Setup the Dongle
This USB dongle has its own built in dialer so you do not need ppp or wvdial installed, it appears as a USB ethernet device on the Raspberry Pi. You will need a powered USB hub as the dongle can draw more power than the Pi can provide, the symptoms of too much of power being drawn will be the Pi behaving erratically or restarting unexpectedly.
With the dongle plugged in, check that it is recognised by the Pi with lsusb, it can be seen here as ‘ZTE WCDMA Technologies MSM’:
The device ID is 19d2. and 1405 is the mode, this should be 1405 – CDC ethernet. If it is not, try removing the micro-SD card and rebooting the Pi, the device modes available are:
1225 – Default mode. USB Mass Storage Device + CD-ROM + card reader.
1403 – Modem mode. RNDIS + Mass Storage Device.
1405 – CDC ethernet
0016 – Download mode
As the dongle also has a Mass Storage Device the Raspberry may not switch to CDC ethernet. If the mode does not change, try the following with usb-modeswitch: $ sudo apt-get install usb-modeswitch
$ sudo usb_modeswitch -v 0x19d2 -p 0x1405 -d
I did not have to change the mode as it was correct already, and it didn’t change when I tried setting it as a Mass Storage device, I have not explored this any further.
When first plugged in the dongle was recognised as a ethernet device but it did not obtain an IP address:
UP BROADCAST RUNNING MULTICAST MTU:1500Metric:1
RX bytes:0(0.0B)TX bytes:0(0.0B)
if this is the case with you, add the following two lines to the end of sudo nano /etc/network/interfaces: auto usb0
iface usb0 inet dhcp
the dongle provides its own address to the computer. Reboot, and you should see the obtained address:
The address 192.168.0.185 is now the internet address of the computer the dongle always assigns this address, there is also a useful web status page on http://192.168.0.1
Configuring the network
first of all enable ip4 forwarding, edit the file sudo nano /etc/sysctl.conf and uncomment the line: net.ipv4.ip_forward=1
this will enable forwarding on reboot, you can also enable IP forwarding immediately with: $ sudo sysctl -w net.ipv4.ip_forward=1
We now need to give the Pi a static IP address on the internal network. Edit sudo nano /etc/network/interfaces so you end up with a file that looks like this:
iface lo inet loopback
iface eth0 inet static
iface usb0 inet dhcp
this gives the Pi a static IP address of 192.168.2.1.
The next stage is to give the other computers on your network an IP address, this is done with a dhcp server: $ sudo apt-get install isc-dhcp-server
you will need to configure dhcp sudo nano /etc/dhcp/dhcpd.conf, here is mine:
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
# give your network printer and file server a static IP addresses
This will assign IP addresses in the range 192.168.2.50 to 192.168.2.150 to any computer connected to your network. I have used Open DNS for the Domain name Servers, if you wish to use google’s use: option domain-name-servers 184.108.40.206, 220.127.116.11;instead.
I have also given my network printer a static IP address, it is still assigned by the DHCP server but never changes, the same would apply to any file servers and the like, I would assign static devices addresses that are outside your dynamically assigned range. Reboot the Pi and then your test computer.
Your test computer should now have an IP address (192.168.2.51), and the gateway point to the Pi (18.104.22.168):
The final part is to have the incoming traffic on the the Ethernet port eth0, go out on the dongle usb0. This is achieved with iptables, a firewall and traffic router. Install with: $ sudo apt-get install iptables
and you need to setup Network Address Translation, NAT and forwarding. This short bash script clears any old settings before applying the new rules:
Where LAN is your internal network, and WAN is the internet. The final line allows you access to the Dongle’s built in web status page from any browser on your internal network, just use: http://192.168.2.1:2525
Save the file in your home directory as ~/ipt.sh, make it executable and run the script.
$ chmod +x ~/ipt.sh
$ sudo ~/ipt.sh
From your test computer, you will now be able to access the internet.
Finally, you now need to have iptables reload when you start the Pi. Export the iptables settings to a file with:
$ sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
and create a file sudo nano /etc/network/if-up.d/iptables with the following contents:
and make it executable sudo chmod +x /etc/network/if-up.d/iptables
after a reboot you can see your iptables with sudo iptables -L and sudo iptables -t nat -L and you can see web traffic passing through the router with sudo tcpdump -i any -nn port 80.
Adding a Proxy Server
This is optional, but a transparent proxy server and cache may reduce the amount of traffic on your 3G/4G connection, mileage varies and the amount of data cached was less than I thought it would be, I also found that my Humax Freesat box really didn’t like the proxy server and wouldn’t update its TV schedules while it was on. I have used squid3 for this. sudo apt-get install squid3
Update the squid3 configuration /etc/squid3/squid.conf so it has the following. The original is rather large, so you may want to make a copy and create a new one:
then restart squid3 sudo /etc/init.d squid3 restart
add the following iptables rule to redirect all traffic on port 80 to squid3: iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
you should now be able to watch the web traffic being processed through squid3 with: sudo tail /var/log/squid3/access.log -f
finish off by exporting your iptables again, so they are reloaded on reboot: sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
The Raspberry Pi does not have a microphone socket, which is inconvenient when you wish to record sound. To fix this you will need a USB Sound Card, for which I bought a Creative Sound Blaster Play! for about £20 and a short USB extension lead as the sound card is slightly too large and blocks the other USB port.
With the latest Raspbian “wheezy” installed on a Pi Model B with 512Mb of RAM and the overclocking set to High in raspi-config, here is a recipe for getting your Raspberry Pi to record sound from the command line. For the test setup I connected my iPod to the microphone port of the sound card, plugged everything in and powered up.
After logging into the Pi, check that the computer can see the card, use lsusb to find it, here the card is highlighted in blue: $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 046d:c52e Logitech, Inc. Bus 001 Device 005: ID 041e:30d3 Creative Technology, Ltd Sound Blaster Play!remember that different makes of card will have different names and ID’s
Your user will need to be in the audio group, check this with groups <username>:
$ groups pi
pi : pi adm dialout cdrom sudo audio video plugdev games users netdev input if not, then add them with:$ sudo usermod -a -G audio <username>
There is/was an issue with the Pi’s USB port that meant it can/could become overwhelmed1 with data which causes popping and bubbling noises to be included in your recordings, this can be fixed with an update of the Pi’s firmware:
The Raspbian image already has the alsa-utils for sound already installed, the programs I am using for recording and playback are:
alsamixer – GUI for setting the recording and playback levels
amixer – Command Line for setting the recording and playback levels
alsactl – for saving the settings set in alsamixer or amixer to use again after a reboot
arecord – For recording the sound
aplay – For playing back your recording
All of these programs have a –help option.
There are two methods for setting up the the microphone port on the card, the first is alsamixer:
$ alsamixerPress F6: Select Sound Card, and choose yours from the list, the bcm2835 ALSA is the on-board sound, for me the one to pick was: USB Device 0x41e:0x30d3 and take a note of the card number, in my case: 1. Now select the Mic and increase the volume to 52, or the first white blob, you’ll need to change it later, but its a good place to start. The Auto Gain Control wants to be off, select the gain control and press M to toggle so it displays [MM] for mute. Press Esc to exit and save the settings with:$ sudo alsactl store 1 where 1 is the card number.
Alternatively, you can use amixer. First find your sound card, in amixer there does not appear to be a method of listing the available cards, but on a Raspberry Pi I guess it will always be card 1, you can list the cards current status with:
$ amixer --card 1 contents
numid=1,iface=MIXER,name='Mic Playback Switch'
numid=2,iface=MIXER,name='Mic Playback Volume'
numid=5,iface=MIXER,name='Mic Capture Switch'
numid=6,iface=MIXER,name='Mic Capture Volume'
numid=7,iface=MIXER,name='Auto Gain Control'
numid=3,iface=MIXER,name='Speaker Playback Switch'
numid=4,iface=MIXER,name='Speaker Playback Volume'
So I want to turn the Auto Gain Control off, and the recording volume to 14:
$ amixer -c 1 cset numid=7,iface=MIXER,name='Auto Gain Control' 0
numid=7,iface=MIXER,name='Auto Gain Control'
$ amixer -c 1 cset numid=6,iface=MIXER,name='Mic Capture Volume' 14
numid=6,iface=MIXER,name='Mic Capture Volume'
again, store the settings so that they will be used again on a reboot:$ sudo alsactl store 1
Now we are ready to do a test recording, first check that arecord will see your card:
$ arecord -l
**** List of CAPTURE Hardware Devices **** card 1: U0x41e0x30d3 [USB Device 0x41e:0x30d3], device 0: USB Audio [USB Audio]
Subdevice #0: subdevice #0
and now for a ten second test recording, this will create a file called rectest.vav in your home directory. Remember to set the Device (-D plughw:1) number to the right card (card 1):
arecord -D plughw:1 --duration=10 -f cd -vv ~/rectest.wav the –vv option displays extra information on the screen as well as a volume meter, this should be peaking at around 95% on the loudest sounds, if it is at 100% all a lot of the time then you are probably recording distortion. Playback the recording with aplay:
the default settings will play the wav fie through the TV if it is connected by HDMI, To playback through the USB sound card set the device to the card number, like in arecord:
aplay -D plughw:1 ~/rectest.wav
Congratulations, you now have a fully working Pi Recording Device. Remember to experiment with the volume levels, too high and your recording will sound distorted.
The Raspberry Pi is a small computer, and as such an obvious but important question occurred to me, and despite Google, I was unable to find an answer. So using science, LEGO, a balloon, and a compressed air supply I set out to discover if the Raspberry Pi could indeed blow a raspberry.
To embark on this scientific discovery, first, I needed to be able to control a motor, for this I built a dual relay board that can be switched using a couple of the Pi’s GPIO pins:
Here is the circuit diagram:
And the Python source code:
To which I connected a large LEGO PF motor. This is used to switch the pneumatic valves via a clutch cog and a large cog. I used a 9v power supply for this, but a PF Battery box can be used, cut an PF extension lead in half, use the light grey side for the motor, and the dark grey end to connect to the battery box. My compressed air supply operates at 2bar / 30 psi, it was built to work with LEGO pneumatics, I found that anything much above that pressure would cause the pipes to pop off the connectors.
Obviously I needed something that would make a sound. For this, a balloon (the sausage type), a small pop bottle, and some more LEGO were suffice. The air is injected into the bottle trough a couple of holes at the rear.
I have built a Toy Organ using a NE555 timer chip and have controlled it with the Raspberry Pi. If you are building this, remember to test with a 6v battery to power the circuit and use a 3v battery on the GPIO input points before you connect it to the Raspberry Pi.
In one of my previous posts I mentioned setting the ownership of the /sys/class/gpio to dialout using /etc/rc.local. This worked up to a point, however entries are created in the gpio when you start using them and they retain the original root group permissions, which means you are required to run your code as root. As this is bad practice I have been looking for ways to get around this, so far setting a udev rule has proved futile.
However, I have found a tool called GPIO Admin and they have also written a Python GPIO API for it, simply install the software, add your user to the gpio group and you have access to the header without having to use root. They have written the API for Python 3, but I have found it will work in Python 2.7 (so far, with the version I downloaded on 29 June 2012, its still in development). The Flask framework has not been updated to work in Python 3.
From reading the Raspberry Pi forum, I see many are wanting to control their hardware projects from the web. Here I will show a method of integrating Python with the Apache web server, and allowing the Apache server access to the GPIO and UART ports without having to run it as root, if you have PHP already installed, both will run in the same environment. For this I am using am using Debian from here: http://www.raspberrypi.org/archives/1435, on a freshly installed SD card.
Part One: Installation, configuration and testing
As root, install the following packages:
# apt-get update
# apt-get upgrade
# apt-get install apache2 libapache2-mod-wsgi python-setuptools python-flask
edit your virtual host in /etc/apache2/sites-enabled, here I have added the wsgi components to the default host 000-default.
Parts easily missed are setting ExecCGI on the Options and adding index.py to the DirectoryIndex. Note that I have set the wsgi to identify python by the extension .py, normally .wsgi is used, I think this is some kind of tradition, or old charter, or something.
Apache on Debian runs as the user www-data, for access to the serial port and GPIO on the Raspberry Pi you will need to add that user to the relevant groups. Do not run apache as root, while this is not so important when on the Pi it is good practice to avoid.
Edit /etc/rc.local and add these two lines to the end of the file:
chgrp -R dialout /sys/class/gpio
chmod -R g+rw /sys/class/gpio
when you reboot the computer, group permissions will be set to dialout on the gpio
add www-data to the dialout group
# usermod -a -G dialout www-data
Update: the /etc/rc.local method does not work, instead I have found found a tool called GPIO Admin and they have also written a Python GPIO API for it. Currently it is under development, but once installed add apache to the gpio group: # usermod -a -G gpio www-data and the web server will have access to the gpio pins
enable the module (it may of been enabled when installed) and restart apache
# a2enmod wsgi
# /etc/init.d/apache2 restart
To test your wsgi installation place the following file into your apache root directory /var/www as myinfo.py and load it using your web browser, http://<pi’s ip address>/myinfo.py .
Part 2: Using The Flask Framework
Here I have made a simple demonstration of how to use Flask, it consists of a wrapper, demo.py, the actual program coreDemo.py and some html to process, demo.html. It does not show how to use the GPIO or UART. The wrapper is used to capture error messages and conveniently display them in the web browser. Again save these files into your apache root directory, /var/www and load it using your web browser, http://<pi’s ip address>/demo.py
Now all you have to do is open the port 80 forwarding on your router, and everyone in the world can make your little buzzer project make noises at two in the morning.
Using the latest distribution of Debian for the Raspberry Pi, I wanted add myself as a user and connect to a network share. Here are the steps I took:
install a couple of programs:
# apt-get update
# apt-get upgrade
# apt-get install minicom joe
set default shell to bash, add new user with groups, and set that users password:
# useradd -D -s /bin/bash
# useradd -m -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input <username>
# passwd <username>
created a directory to be shared, and add the samba share to /etc/fstab:
# mkdir /home/raspberry
# nano /etc/fstab
and added this to the end:
//<ip address>/<share> /home/raspberry cifs username=<username>,password=<password>,_netdev,uid=<username> 0 0