📂
my database
  • Introduction
  • Home setup
    • Raspberry
      • OS Installation
      • Enable SSH and first access
      • SSH configuration
      • Change default credentials
      • Home DNS
      • WiFi USB
      • Live cam
      • ESP32
      • AD/DA
      • Humidity sensors
    • Remote access
      • ssh
      • Turn on/off remote computer
      • Dynamic DNS
      • Remote ssh
      • Home VPN
  • GNU/Linux commands
    • locale
    • crontab
    • chmod
    • router
  • Future sections
    • Topics
  • Research
    • Introduction to Sustainability
Powered by GitBook
On this page
  • Set static IP
  • Change ssh port

Was this helpful?

  1. Home setup
  2. Raspberry

SSH configuration

PreviousEnable SSH and first accessNextChange default credentials

Last updated 4 years ago

Was this helpful?

Set static IP

Open the file /etc/dhcpcd.conf and place the following lines of code, which configures the connection using the eth0 (ethernet) interface:

/etc/dhcpcd.conf
# Example static IP configuration:
interface eth0
static ip_address=192.168.1.X/24
static routers=192.168.1.1
static domain_name_servers=8.8.8.8 8.8.4.4

In the example above, we have used 192.168.1.X/24 as the static private IP and 192.168.1.1 is the IP of our router (a.k.a. gateway, check it using router -n command).

Finally, restart the device

sudo reboot
  • (Post)

  • (Video)

Change ssh port

A good practice to increase security is to change the default ssh port (22) to a different one (higher than 1000, lower than 65535). Open the ssh configuration (file /etc/ssh/sshd_config) and uncomment the line called “Port 22” and change it to

/etc/ssh/sshd_config
Port [SSH_NEW_PORT]

Finally, restart ssh service

sudo service ssh restart

Now, to access the raspberry type:

$ ssh -p [SSH_NEW_PORT] pi@192.168.1.X

How to Setup a Raspberry Pi Static IP Address
How to assign static IP address to Raspberry Pi
How to change your SSH Port on the Raspberry Pi