You are not logged in.

#1 2011-03-07 16:02:43

M_ller
Member
Registered: 2010-04-17
Posts: 80
Website

[SOLVED] Remote SSH - What to consider?

Hey fellow archers.

I am currently interested in having access to my desktop PC while being on the fly.
I am however very uncertain what precautions I should take and how it should all work. I'd like to use SSH for this, but what should I do to make it secure since it would be running remotely?

Marcus

Last edited by M_ller (2011-03-07 21:34:46)

Offline

#2 2011-03-07 16:05:27

lifeafter2am
Member
From: 127.0.0.1
Registered: 2009-06-10
Posts: 1,332

Re: [SOLVED] Remote SSH - What to consider?

M_ller wrote:

Hey fellow archers.

I am currently interested in having access to my desktop PC while being on the fly.
I am however very uncertain what precautions I should take and how it should all work. I'd like to use SSH for this, but what should I do to make it secure since it would be running remotely?

Marcus

Use a non-standard port for your SSH server.  Use key-based authentication.   Do not allow root logins.

https://wiki.archlinux.org/index.php/Using_SSH_Keys

Last edited by lifeafter2am (2011-03-07 16:05:47)


#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.

Offline

#3 2011-03-07 16:35:54

M_ller
Member
Registered: 2010-04-17
Posts: 80
Website

Re: [SOLVED] Remote SSH - What to consider?

lifeafter2am wrote:
M_ller wrote:

Hey fellow archers.

I am currently interested in having access to my desktop PC while being on the fly.
I am however very uncertain what precautions I should take and how it should all work. I'd like to use SSH for this, but what should I do to make it secure since it would be running remotely?

Marcus

Use a non-standard port for your SSH server.  Use key-based authentication.   Do not allow root logins.

https://wiki.archlinux.org/index.php/Using_SSH_Keys

Thanks!
Setting up the key-based auth. was really easy and works perfectly!
Should I create a new user for my ssh logins etc, or how can I disable root logins?

- Marcus

EDIT: It is all working nicely, however if I don't have the SSH key file, it just asks for the password of the specified user, is it possible to disable that, so they can only connect when having the file?

Last edited by M_ller (2011-03-07 16:45:13)

Offline

#4 2011-03-07 16:43:45

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,680

Re: [SOLVED] Remote SSH - What to consider?

M_ller wrote:

Should I create a new user for my ssh logins etc, or how can I disable root logins?

- Marcus

Edit /etc/ssh/sshd_config and make sure that PermitRootLogin is set to no

Offline

#5 2011-03-07 16:44:34

Foucault
Member
From: Athens, Greece
Registered: 2010-04-06
Posts: 214

Re: [SOLVED] Remote SSH - What to consider?

M_ller wrote:

Should I create a new user for my ssh logins etc, or how can I disable root logins?
- Marcus

No need to create a new user. Just disable root access. Edit /etc/ssh/sshd_config and locate the line that says "PermitRootLogin" and ensure its set to no.

Offline

#6 2011-03-07 16:56:22

Kosmonavt
Member
Registered: 2010-02-15
Posts: 100

Re: [SOLVED] Remote SSH - What to consider?

Also you can set this in /etc/ssh/sshd_config to prevent from password brute forcing by turning password access off:

PasswordAuthentication no

Basically, that's all. There are more methods of securing SSH, but these aren't very common and such efficient:

1) fail2ban. After some sequental authentication failures it blocks this IP. Use with caution!
2) opening ssh port only after some manipulations. Using iptables and some more utils, you can make ssh available only after sending packets on "secret" ports.

Offline

#7 2011-03-07 17:08:33

M_ller
Member
Registered: 2010-04-17
Posts: 80
Website

Re: [SOLVED] Remote SSH - What to consider?

Thanks for all your help.
However, when PermitRootLogin is set to no, I can still do "su" within in SSH'd terminal and then type in the root password, and then be logged in as root.
Am I supposed to be able to do that?

When I try to use my external IP to connect to my SSH server, it gives me this error:
xxxxx: no route to host

I guess that is just a router forwarding problem?

EDIT: And what does "UseLogin no" mean in the sshd_config file?

Last edited by M_ller (2011-03-07 17:10:14)

Offline

#8 2011-03-07 17:10:25

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

Re: [SOLVED] Remote SSH - What to consider?

fail2ban is really nice and it will only ban for 15 minutes because usually the targets are random and not targeted. Therefore if you accidentally ban yourself can wait through the timeout.


Website - Blog - arch-home
Arch User since March 2005

Offline

#9 2011-03-07 17:27:38

parmegv
Member
From: https://identi.ca/parmegv/
Registered: 2010-11-10
Posts: 15
Website

Re: [SOLVED] Remote SSH - What to consider?

Hello,

I am trying to set up my SSH server but I cannot manage to do it well. In fact, I have this post in order to solve it. Could you please tell me what do you see in my sshd_config file anormal? Or just simply post your file letting me to compare them myself?

Thank you very much

Offline

#10 2011-03-07 17:33:29

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] Remote SSH - What to consider?

parmegv: you have managed to both cross-post and thread hijack: https://wiki.archlinux.org/index.php/Fo … _Hijacking

Please do not do this again.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#11 2011-03-07 17:55:55

parmegv
Member
From: https://identi.ca/parmegv/
Registered: 2010-11-10
Posts: 15
Website

Re: [SOLVED] Remote SSH - What to consider?

jasonwryan wrote:

parmegv: you have managed to both cross-post and thread hijack: https://wiki.archlinux.org/index.php/Fo … _Hijacking

Please do not do this again.

Understood. Should I edit that message, or just send a private message to the one I am interested in?

Offline

Board footer

Powered by FluxBB