Automatically start ssh daemon under Mint

All about the serious stuff.

Moderators: Mug UK, Zorro 2, Moderator Team

Post Reply
JeanMars
Captain Atari
Captain Atari
Posts: 266
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Automatically start ssh daemon under Mint

Post by JeanMars »

Hi all,

I have a stupid problem: automatically start ssh daemon (sshd) when booting Mint.
Right now, I 'm forced to type "/usr/sbin/sshd" from a terminal inside Mint to enable SSH access.
BTW, terminal window automatically closes, not sure it is expected...

If I put the following line in mint.cnf:
exec u:\usr\sbin\sshd

Mint boot complains that sshd-reexec requires execution with an an absolute path...

Any idea to make this work?
Thanks,
Jean
User avatar
derkom
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 110
Joined: Fri Jul 20, 2018 10:29 pm

Re: Automatically start ssh daemon under Mint

Post by derkom »

I've got mine starting by adding it to /etc/rc.d/rc.local, but that will work only if you have an init-based MiNT system I believe.

sshd is saying that because apparently the way mint.cnf is starting it, it's not executing the binary as a full path to the binary, despite looking that way in mint.cnf. You may be able to make the problem go away by writing a quick shell script to run it (with the full path of course), and then call that from mint.cnf.

Just a thought. Someone else probably has a better answer.
User avatar
AdamK
Captain Atari
Captain Atari
Posts: 327
Joined: Wed Aug 21, 2013 8:44 am

Re: Automatically start ssh daemon under Mint

Post by AdamK »

sshd is not a good idea for Atari, because even on 060 it will eat sizeable chunk of CPU time for encryption. If you consider your network secure, I'd suggest using telnet instead - it has much lower overhead.
Atari: FireBee, Falcon030 + CT60e + SuperVidel + SvEthlana, TT, 520ST + 4MB ST RAM + 8MB TT RAM + CosmosEx + SC1435, 1040STFM + UltraSatan + SM124, 1040STE 4MB ST RAM + 8MB TT RAM + CosmosEx + NetUSBee + SM144 + SC1224, 65XE + U1MB + VBXE + SIDE2, Jaguar, Lynx II, 2 x Portfolio (HPC-006)

Adam Klobukowski [adamklobukowski@gmail.com]
ThorstenOtto
Atari God
Atari God
Posts: 1190
Joined: Sun Aug 03, 2014 5:54 pm

Re: Automatically start ssh daemon under Mint

Post by ThorstenOtto »

JeanMars wrote: BTW, terminal window automatically closes, not sure it is expected...
That is just a setting in toswin2. You can change it either globally, or for a specific program.
Any idea to make this work?
I think using

Code: Select all

exec /usr/sbin/sshd
instead should work. sshd is ported from unix sources, so it most likely does not recognize pathes with drive letters as being absolute
mikro
Hardware Guru
Hardware Guru
Posts: 2218
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Automatically start ssh daemon under Mint

Post by mikro »

That error is a bit misleading. Start your sshd as:

/usr/sbin/sshd -r -D

(I use INIT= but exec is fine, too), that will also prevent the process from detaching (closing the window).

Btw it is sshd which is complaining, not FreeMiNT.
JeanMars
Captain Atari
Captain Atari
Posts: 266
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: Automatically start ssh daemon under Mint

Post by JeanMars »

Hi mikro/Throsten,

exec /usr/sbin/sshd: sshd re-exec requires execution with an an absolute path
exec /usr/sbin/sshd -r -D: boot stops with 4 line "/pipe/log: no such file or directory.", control-c resumes normal boot sequence.
BTW sshd -r -D works from a terminal.

@adamK: ssh is not a problem for me, I'm using Aranym on a Windows machine; never seen a performance degradation.
User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12928
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Automatically start ssh daemon under Mint

Post by wongck »

JeanMars wrote: exec /usr/sbin/sshd -r -D: boot stops with 4 line "/pipe/log: no such file or directory.", control-c resumes normal boot sequence.
Missing pipe/log is due to missing system logging, Mint does have an RPM sysklogd-1.3-5.m68kmint.rpm.

Another way may be helpful, is to exec bash and make bash run sshd and redirect output into a file, so you can see stdout on the console & a record of it. Sure running bash full may slow down the processes but then you are on Aranym. :wink:
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list
mikro
Hardware Guru
Hardware Guru
Posts: 2218
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Automatically start ssh daemon under Mint

Post by mikro »

JeanMars wrote:exec /usr/sbin/sshd -r -D: boot stops with 4 line "/pipe/log: no such file or directory.", control-c resumes normal boot sequence.
BTW sshd -r -D works from a terminal.
Yes, this is expected, this is what "-D" does - it doesn't exit immediately. So if you want it to run as a daemon (in the background), remove that switch.

The /pipe/log can be safely ignored. Also, wongck is correct, you can add "-E /root/sshd.log -o LogLevel=DEBUG" to have a better idea what is going on.
JeanMars
Captain Atari
Captain Atari
Posts: 266
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: Automatically start ssh daemon under Mint

Post by JeanMars »

Hi,

@mikro:
tried exec /usr/sbin/sshd -E /root/sshd.log -o LogLevel=DEBUG from mint.cnf:
same result: sshd re-exec requires execution with an an absolute path
and no /root/sshd.log file log generated

@wongck:
looks like sysklogd is installed:
root@mint:/root>rpm -qa | grep sysklogd
sysklogd-1.3-5

If I try the following in mint.cnf:
exec /bin/bash /root/sshd.sh
where sshd.sh is:
/usr/sbin/sshd -E /root/sshd.log -o LogLevel=DEBUG
It works :-)
And I get the /root/sshd.log file properly generated!

Finally made it work even if I don't understand why sshd complains about the full path if started with /usr/sbin/sshd directly from mint.cnf

Thanks for your hints,
Jean
User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12928
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Automatically start ssh daemon under Mint

Post by wongck »

if you have sysklogd running, you should have a file called 'log" in your u:/pipe ... that is the missing log that was reporting.
Not sure how your system is setup... but may be check your init & rc run scripts.

SSH is not something I use, I only does telnet, so I don't really know what it uses but the re-directions looks like probably using bash mechanisms (..??) so it need bash full to run.

well, i always run executable in CNF using bash because I believe not all plumbing are implemented by the exec command.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list
ThorstenOtto
Atari God
Atari God
Posts: 1190
Joined: Sun Aug 03, 2014 5:54 pm

Re: Automatically start ssh daemon under Mint

Post by ThorstenOtto »

JeanMars wrote:Hi,
Finally made it work even if I don't understand why sshd complains about the full path if started with /usr/sbin/sshd directly from mint.cnf
I think the problem is, that the mint parser does not use the ARGV method when executing programs. It only passes arguments via the basepage, but those do not contain the path to the program. Hence argv[0] in the executed program is set to "" or some other magic string.
mikro
Hardware Guru
Hardware Guru
Posts: 2218
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Automatically start ssh daemon under Mint

Post by mikro »

JeanMars wrote:tried exec /usr/sbin/sshd -E /root/sshd.log -o LogLevel=DEBUG from mint.cnf:
same result: sshd re-exec requires execution with an an absolute path
and no /root/sshd.log file log generated
But you didn't add that "-r" switch, did you. :)

EDIT: but actually Thorsten is right - the real culprit is argv[0] being empty. Just checked this. The "-r" switch is just a workaround.
Last edited by mikro on Sun Apr 26, 2020 8:27 am, edited 1 time in total.
mikro
Hardware Guru
Hardware Guru
Posts: 2218
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Automatically start ssh daemon under Mint

Post by mikro »

wongck wrote:SSH is not something I use, I only does telnet, so I don't really know what it uses but the re-directions looks like probably using bash mechanisms (..??) so it need bash full to run.
It definitely doesn't. As mentioned, I use "INIT=/usr/sbin/sshd -r -D -E /h/sshd.log -o LogLevel=DEBUG" quite nicely.
User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12928
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Automatically start ssh daemon under Mint

Post by wongck »

Ah you used INIT. That's clever but of course you are.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list
ThorstenOtto
Atari God
Atari God
Posts: 1190
Joined: Sun Aug 03, 2014 5:54 pm

Re: Automatically start ssh daemon under Mint

Post by ThorstenOtto »

INIT behave the same in this regard (it only uses the p_cmdlin from the basepage). It's only the -r switch that prevents sshd from complaining.
User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 856
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: Automatically start ssh daemon under Mint

Post by mfro »

My sshd (6.4p1) does not understand the -r switch (just as Linux sshd's do). What is it?
I run sshd through bash, anyway.

P.S.: oops, it does. But not mentioned anywhere, neither in man page nor in usage help?
JeanMars
Captain Atari
Captain Atari
Posts: 266
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: Automatically start ssh daemon under Mint

Post by JeanMars »

But you didn't add that "-r" switch, did you. :)
Ooops, you're right :-)
It works with this line in mint.cnf:
exec /usr/sbin/sshd -r
but still this annoying "/pipe/log: no such file or directory" message.
And yes I have a pipe /pipe/log:
root@mint:/root>ll /pipe/log
prw-rw-rw- 1 root root 4096 Apr 26 22:39 /pipe/log

BTW, what does "-r" means? It does not even show in man sshd.
Latz
Captain Atari
Captain Atari
Posts: 282
Joined: Tue Mar 08, 2011 6:02 pm
Location: Germany
Contact:

Re: Automatically start ssh daemon under Mint

Post by Latz »

Hi,
JeanMars wrote:but still this annoying "/pipe/log: no such file or directory" message.
This is with EasyMiNT?
Perhaps at this point starting sshd (in mint.cnf), sysklogd is not started yet - This is done by init program, so better
start sshd with a script from /etc/rc.d/init.d/...

Lars
Falcon/CT60 90MHz, 14+128 MB RAM, CTPCI/Radeon 9250/RTL8139, Carte Eiffel+LCD, 32GB CF card, DVD-RW.
Falcon/CT63 95MHz, 4+128 MB RAM, CTPCI/Radeon 9250/RTL8139, Carte Eiffel+LCD, 16GB IDE CF card, CD-RW.
mikro
Hardware Guru
Hardware Guru
Posts: 2218
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Automatically start ssh daemon under Mint

Post by mikro »

-r is so called re-exec flag, or to be precise, it's inversion. And yes, it is unofficial, i.e. you shouldn't really use it / need it for other than debugging purposes. It basically inhibits re-executing sshd in a safer context (that is why the absolute path is needed, so it can re-execute itself).
JeanMars
Captain Atari
Captain Atari
Posts: 266
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: Automatically start ssh daemon under Mint

Post by JeanMars »

Hi,

@Latz: this is probably the cleaner way, I had a look at /etc/rc.d/init.d scripts but I don't feel very comfortable to write one :-) So mint.cnf trick will be my choice right now
@mikro: thanks for the -r explanation

Cheers,
Jean
JeanMars
Captain Atari
Captain Atari
Posts: 266
Joined: Fri Apr 09, 2010 5:15 pm
Location: France
Contact:

Re: Automatically start ssh daemon under Mint

Post by JeanMars »

Hi all,

just to share with you a working solution coming from Latz about adding a script to /etc/rc.d/init.d:

- copy script "sshd" to /etc/rc.d/init.d/
- copy sshd.config to /etc/ssh/

For manual start, use command "/etc/rc.d/init.d/sshd start" from now.
Automatic start is done if you edit a line "sshd" either in /etc/sysconfig/std.services
(after line syslog) or in file /etc/sysconfig/add.services.

sshd runs in background (daemon) mode with this. If you want to start it
with any additional options (like -r or -D), edit a line

OPTIONS="-r -D"

in script sshd (where the other variables are set).
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “Applications”