Search Good guide
Check for existing SSH keys
If you allready have key pair
ssh-keygen -R 192.168.2.70
Generate new SSH keys
To generate new SSH keys enter the following command (Choose a sensible hostname such as
ssh-keygen -t rsa -C eben@pi
You can also use a more descriptive comment using quotes if you have spaces, e.g. ssh-keygen -t rsa -C “Raspberry Pi #123”
Upon entering this command, you’ll be asked where to save the key. We suggest you save it in the default location (/home/pi/.ssh/id_rsa) by just hitting Enter.
You’ll also be asked to enter a passphrase. This is extra security which will make the key unusable without your passphrase, so if someone else copied your key, they could not impersonate you to gain access. If you choose to use a passphrase, type it here and press Enter, then type it again when prompted. Leave the field empty for no passphrase.
Now you should see the files id_rsa and id_rsa.pub in your .ssh directory in your home folder:
authorized_keys id_rsa id_rsa.pub known_hosts
The id_rsa file is your private key. Keep this on your computer.
The id_rsa.pub file is your public key. This is what you put on machines you want to connect to. When the machine you try to connect to matches up your public and private key, it will allow you to connect.
Take a look at your public key to see what it looks like:
It should be in the form:
ssh-rsa <REALLY LONG STRING OF RANDOM CHARACTERS> eben@pi
Copy your public key to your device
If your Pi does not have an .ssh directory you will need to set one up so that you can copy the key from your computer.
cd ~ install -d -m 700 ~/.ssh
To copy your public key to your Raspberry Pi, use the following command to append the public key to your authorized_keys file on the Pi, sending it over SSH:
cat ~/.ssh/id_rsa.pub | ssh <USERNAME>@<IP-ADDRESS> 'cat >> .ssh/authorized_keys'
cat ~/.ssh/id_rsa.pub | ssh firstname.lastname@example.org 'cat >> .ssh/authorized_keys' cat ~/.ssh/id_rsa.pub | ssh email@example.com 'cat >> .ssh/authorized_keys'
Make bash script runable
Give execute permission to your script:
chmod +x /path/to/yourscript.sh
And to run your script:
Since . refers to the current directory: if yourscript.sh is in the current directory, you can simplify this to:
Type the df command shows more human readable output:
mount mount -l
df -h ls -l --block-size=M
Wifi and Network
- Guide for setting wifi
sudo iwlist wlan0 scan | grep ESSID
Find LAN devices (works with OSX Terminal)
Give permission to testuser:testuser to dir
sudo chown -R testuser:testuser /var/www/test/public_html
system("rsync -arv --delete ~/folder/ ~/temp/")
and all it content
rm -rf directoryname
Copy files system to ssh
sudo cp filelocation pi@verkkovadelma:/home/pi
View client shares
smbclient -L 192.168.2.90
Connect to share
curlftpfs -o allow_other ftp-user:firstname.lastname@example.org /mnt/my_ftp/
User account and groups
Grant normal user to have permission to use GPIO.
sudo adduser my_new_user gpio
Add user to group
usermod -a -G GROUP USER
Remove User from Group
sudo gpasswd -d USER GROUP
You can fix the issue by setting the locale to en_US.UTF-8 for example:
export LANGUAGE=en_US.UTF-8 export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 locale-gen en_US.UTF-8 dpkg-reconfigure locales
Once you run the last command a dialog will appear to let you choose the desired locale.
ps aux | grep apache2
How to check Kernel version?
uname -a uname -v
How to check ip address?
ifconfig ip addr show ip addr show wlan0
How to check disk space used?
How to check process status?
service udev status systemctl status udev
How to check folder size?
du -sh brootbot/
How to check what ports are being used?
netstat netstat -tulpn
How to check CPU usage of certain process?
ps aux | grep apache2 htop top
How to mount drive?
ls /mnt mount /dev/sd2 /mnt/ab
How to check existing mounts?
Mount file in boot, what file you would looking?
How to find answer for commands?
man <command> man ps