systemctl start <sshd | ssh>
ssh: server and dynamic port forwarding
running sshd
keep in mind that running sshd
on ubuntu, starts server in current
user scope, and won’t start it system-wide. thus, when running these commands:
-
/usr/sbin/sshd
and then -
systemctl start sshd
you get inactive
as the response. so, to start server system-wide just run
the following command:
now, after running system status sshd
command, you’ll find its status changed
to active
.
This is only done to ease management of ssh server through systemctl
commands
sshd.service
not found on ubuntu
-
sudo apt purge openssh-server
-
sudo apt install openssh-server -y
here, the purge
command is what makes the difference.
ssh config file
when you start system-wide ssh server through systemctl
, you should edit
global config file which is usually located in /etc/ssh/sshd_config/
.
configuring server through sshd -f <your-config-file>
is done only when you start
client-wide ssh server.
which key where
small reminder here
-
remote
hostkey
→ localknown_hosts
-
local
publickey
→ remoteauthorized_keys
dynamic port forwarding
to configure dynamic port forwarding, ssh makes use of socks
protocol. thus
general syntax is:
ssh -D <local-port> <remote-username>@<remote-host>
then i wanted to enter something like this in firefox search bar
localhost:8000
to get into my vmware machine, but firefox wouldn’t allow me to. after some searching, i’ve found this issue described here
the thing is, is that firefox browser won’t tunnel localhost
address through
proxy, thus you need to change firefox internal configuration in order to
force it:
-
type
about:config
in search bar, then accept all risks and continue -
change
network.proxy.allow_hijacking_localhost
to true
that’s it. now you can proxy you localhost
address w/ firefox. but keep in
mind that these settings vary between different browsers.
recommended book: ssh - oreilly