Send email in Linux command line.

Working in raspbian os.

$ sudo apt-get install ssmtp
$ sudo apt-get install mailutils

# Added these lines and commented out any lines that were duplicates
$ sudo nano /etc/ssmtp/ssmtp.conf

# send email
$ echo "This is a test" | mail -s "Test"

# troubleshooting errors
$ tail -f /var/log/mail.log


Connect to wifi in the command line

The wifi access point security will determine the way you connect to it.

If WEP (less secure)


Configuring WPA
# view enabled connections
$ ifconfig

# view enabled and disabled connections
$ ifconfig -a

# To find out the name of your wireless card device. Look at the row that has some information in it, not ‘no wireless extensions’. In this example its wlan0.
$ iwconfig

# find wireless/wifi access points
$ sudo iwlist scan
$ nmcli dev wifi list # source
# an alternative can be “wavemon” if installed on your machine

# Add wifi network ssid and password
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
# add to the bottom of file


# wpa_supplicant.conf is being included in /etc/network/interfaces. Another option would be to edit interfaces file directly. Example Below.

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0

iface wlan0 inet dhcp
	wpa-ssid "your_wireless_ssid"
	wpa-psk "your_wireless_password"

# restart connection. This is an alternative to restarting the computer
$ sudo ifdown wlan0
$ sudo ifup wlan0

# you should now see an ip address under “inet addr:”
$ ifconfig wlan0

# test internet connection
sudo ping

# useful commands
# 10 Useful “IP” Commands to Configure Network Interfaces

$ ip addr show
$ ip route show

wireless interface, network, raspberry pi

Create a router/Access Point for wifi

followed these instructions

Ran these commands
1 sudo apt-get update
2 sudo apt-get install hostapd isc-dhcp-server
3 sudo nano /etc/dhcp/dhcpd.conf
4 sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.orig
5 sudo nano /etc/dhcp/dhcpd.conf
6 sudo nano /etc/default/isc-dhcp-server
7 sudo ifdown wlan0
8 sudo cp /etc/network/interfaces /etc/network/interfaces.orig
9 sudo nano /etc/network/interfaces
10 ifconfig
11 sudo ifconfig wlan0
12 ifconfig
13 sudo nano /etc/hostapd/hostapd.conf
14 sudo cp /etc/default/hostapd /etc/default/hostapd.orig
15 sudo nano /etc/default/hostapd
16 sudo cp /etc/sysctl.conf /etc/sysctl.conf.orig
17 sudo nano /etc/sysctl.conf
18 sudo sh -c “echo 1 > /proc/sys/net/ipv4/ip_forward”
19 sudo nano /etc/sysctl.conf
20 sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
21 sudo iptables -A FORWARD -i eth0 -o wlan0 -m state –state RELATED,ESTABLISHED -j ACCEPT
22 sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
23 sudo iptables -t nat -S
24 sudo iptables -S
25 sudo iptables -L
28 sudo sh -c “iptables-save > /etc/iptables.ipv4.nat”
29 sudo nano /etc/network/interfaces
30 wget
31 unzip
32 sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.ORIG
33 sudo mv hostapd /usr/sbin
34 sudo chmod 755 /usr/sbin/hostapd
35 sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
40 sudo raspi-config
41 sudo reboot
43 sudo service hostapd status
44 sudo service hostapd start
45 sudo service isc-dhcp-server start
46 sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf
47 sudo service hostapd status
48 sudo update-rc.d hostapd enable
49 sudo update-rc.d isc-dhcp-server enable
50 sudo mv /usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service ~/

created an image backup called

additional help

Turn Your Raspberry Pi Into a WiFi Hotspot with Edimax Nano USB EW-7811Un (RTL8188CUS chipset)

Browse Anonymously with a DIY Raspberry Pi VPN/TOR Router

Vagrant miscellaneous

to sync the /var/www folder with the host computer
1. edit Vagrantfile and add this line config.vm.synced_folder “www/”, “/var/www/”
2. create a folder called www where the Vagrantfile is located
3. read up on some resources if need be

enable symlink on a shared/sync folder
1. follow these instructions
2. ran these command in windows cmd
– cd C:\Program Files\Oracle\VirtualBox
– VBoxManage.exe setextradata local.puphpet17 VBoxInternal2/SharedFoldersEnableSymlinksCreate/node 1
– VBoxManage getextradata local.puphpet17 enumerate
should see ‘Key: VBoxInternal2/SharedFoldersEnableSymlinksCreate/node, Value: 1’
3. Run vagrant as windows administrator

Nodejs troubleshooting

I kept getting many errors in npm install

seems that the error comes from symlink not being able to work in vagrant
partial solution: run ‘$ sudo npm install –no-bin-links’
The reason you are getting errors is because you are in vagrant synced folder. If you go to a non synced folder the error will not occur. You can also change vagrant to accept symlink on shared/synced folder. Instructions at

Tried to run “$ npm run build” for use in browserify but got this error.

/usr/bin/env: node: No such file or directory
npm ERR! weird error 127
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read

npm ERR! not ok code 0

The solution was to run
$ sudo apt-get install nodejs-legacy

If you don’t have the latest version of npm errors may occur when installing packages
# check version in server. npm current version is shown in
$ npm -v
# install latest version. you must run this twice I dont know why.
$ sudo npm install -g npm@latest