login: pi
password: raspberry
sudo raspi-config
Navigate in the menu with arrows →
←
↑
↓
keys and select with enter ↲
key.
Then then follow the instruction and select your configuration.
sudo raspi-config
Then provide a name for your server.
sudo apt-get update
sudo apt-get upgrade
❗ The upgrade should ask for consent, type yes
.
sudo passwd root
# Then enter the password for your the super-user.
❗ On Raspberry PI OS you won't see anything when you'll type your password. This is normal this is a Security option, each keys are reccorded (in the password field).
sudo passwd pi
exit
Log-in as root. Then change the default username with.
usermod -l yourusername pi
usermod -m -d /home/yourusername yourusername
❗ Replace yourusername
with your username.
Ethernet interface
(ETH) and you want to disable the Wireless Local Area Network
(WLAN) type :
The effects of this command will be reset on reboot.
ifconfig wlan0 down
This command disable the wifi and it will stay off on reboot.
dtoverlay=disable-wifi
➕ Bonus : disable the bluetooth with dtoverlay=disable-bt
.
As user enable the SSH with :
sudo raspi-config
Your SSH is now live !
If you want to connect to your server inside your local network :
type ifconfig
save the inet 192.168.1.XX
.
Then in a cmd shell type ssh username@yourlocalip
.
❗ Replace username
with your username (example : pi); yourlocalip
with your local IP adress.
Example : ssh paul@192.168.1.42
Configure the NAT (Network Address Translation) page in your router. In your browser (Google Chrome or any) type : http://192.168.1.1/
Find your NAT page on your router (may be on Network v4 menu). Then add a Redirection with the following parameters.
External Port : 22 Destination Port : 22 Protocol : TCP Target IP : 192.168.1.XX
❗ Replace the 192.168.1.XX
with the inet
value in ifconfig.
:warning: Setting names may vary in order to your network provider.
Then find your router IP adress and in a cmd shell type ssh yourusername@yourIP
.
Example : ssh paul@108.177.16.0
sudo nano /etc/ssh/sshd_config
Scroll and change the PermitRootLogin
setting to PermitRootLogin yes
.
❗ Save with CTRL
+ X
type y
then enter ↲
.
sudo nano /etc/ssh/sshd_config
Scroll and change the PrintLastLog
setting to PrintLastLog no
.
❗ Save with CTRL
+ X
type y
then enter ↲
.
Change the default MOTD (Message Of The Day).
sudo nano /etc/update-motd.d/10-uname
Following this color map replace $(tput setaf colornumberhere)
with the color you want.
The following example will display a cat on the user session when connecting. Paste the following code and "edit the cat".
#!/bin/sh
export TERM=xterm-256color
echo "
$(tput setaf 5)
_
\`*-.
) _`-.
. : `. .
: _ ' \
; *` _. `*-._
`-.-' `-.
; ` `.
:. . \
. \ . : .-' .
' `+.; ; ' :
: ' | ; ;-.
; ' : :`-: _.`* ;
.*' / .*' ; .*`- +' `*'
`*-* `*-* `*-*'
$(tput sgr0)"
Everything inside the echo " text here "
will be displayed (except for the color represented by $(tput setaf colornumberhere)
).
You can delete everything if you don't want to display the text.
sudo nano /etc/motd
You can add color with the following map of color codes :
Black 0;30 Dark Gray 1;30
Red 0;31 Light Red 1;31
Green 0;32 Light Green 1;32
Brown/Orange 0;33 Yellow 1;33
Blue 0;34 Light Blue 1;34
Purple 0;35 Light Purple 1;35
Cyan 0;36 Light Cyan 1;36
Light Gray 0;37 White 1;37
Example :
^[[H^[[2J
^[[01;31m
_
\`*-.
) _`-.
. : `. .
: _ ' \
; *` _. `*-._
`-.-' `-.
; ` `.
:. . \
. \ . : .-' .
' `+.; ; ' :
: ' | ; ;-.
; ' : :`-: _.`* ;
.*' / .*' ; .*`- +' `*'
`*-* `*-* `*-*'
^[[0m
^
+ [
, press esc
+ v
+ esc
to create this special character.
You can delete everything if you don't want to display the text.
Each user can customise his primary prompt with:
Example you can repeat this operation as root
, pi
, etc..
.
sudo nano ~/.bashrc
Edit the PS1
value on this line on any user (except root)
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;34m\]\u@\h\[\033[00m\]:\[\033[01;95m\]\w \$\[\033[00m\] '
Symbols meanning :
\u = username
\h = hostname
\w = current working directory
Do the same thing logged in as root.
sudo apt-get install python3-pip #pip (package manager for python3)