ssh anomaly perhaps or maybe I just dont understand

a very small Live CD shaped to look and act like Puppy Linux.

Moderator: fredx181

Post Reply
User avatar
ocpaul20
Posts: 33
Joined: Tue Jul 14, 2020 3:46 am
Location: PRC
Has thanked: 4 times
Been thanked: 1 time

ssh anomaly perhaps or maybe I just dont understand

Post by ocpaul20 »

I have some scripts in /root/Startup on my PC machine which are executed on boot by root. Stuff like mounting disks, starting mysql, nginx, and checking if they are running, etc

However, when I ssh into the PC machine from another machine (laptop) as puppy@remotehost these same root scripts execute as puppy after I have entered puppy's password. These scripts have permissions 744 in their scripts directory (so should not run as puppy) but have 777 as links in /root/Startup to this scripts directory.

Even when I login as puppy (from root) on the source laptop machine, and then ssh to the remote PC machine to puppy@remotehost I still get the ssh session executing the root/Startup scripts.

These scripts do not execute if I login as puppy on the remote host PC machine, as puppy has its own Startup directory under /home/puppy/ .

I suppose this could all happen if the ssh session logs in as root and then logs in as puppy afterwards, but I do not want the root/Startup scripts to execute. How do I achieve that please?

I am not expecting this to happen, can someone explain what is going on please?
( I dont think I am being stupid but it is always possible I have overlooked something !)

Thanks,
Paul
(Have I totally confused you all now??)

System: Fanless PC DebianDog Buster Frugal

User avatar
snoring_cat
Posts: 206
Joined: Tue Sep 21, 2021 3:40 pm
Location: Earth
Has thanked: 24 times
Been thanked: 46 times

Re: ssh anomaly perhaps or maybe I just dont understand

Post by snoring_cat »

I think you should move your startup scripts to /etc/init.d or equivalent folder. Then they will be run once on boot up, independent of user login. Things that you want run per session start could go in Startup.

On a side node. I can't recall how Puppy Linux triggers running Startup executables. I know that The Startup folder works differently depending on which Puppy version you are running.

Meeeooow!

-- substance over noise, since 5 minutes in the future --

williams2
Posts: 1028
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 293 times

Re: ssh anomaly perhaps or maybe I just dont understand

Post by williams2 »

I can't recall how Puppy Linux triggers running Startup executables

In /usr/sbin/delayedrun

Code: Select all

if [ -d /root/Startup ];then
 for A in /root/Startup/* ; do
  $A 2>/dev/null & 
  sleep 0.2
 done
fi
User avatar
ocpaul20
Posts: 33
Joined: Tue Jul 14, 2020 3:46 am
Location: PRC
Has thanked: 4 times
Been thanked: 1 time

Re: ssh anomaly perhaps or maybe I just dont understand

Post by ocpaul20 »

OK thanks. Then I will move stuff to /etc/init.d and see how that goes.

System: Fanless PC DebianDog Buster Frugal

User avatar
fredx181
Posts: 2680
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 295 times
Been thanked: 1056 times
Contact:

Re: ssh anomaly perhaps or maybe I just dont understand

Post by fredx181 »

ocpaul20 wrote:

Even when I login as puppy (from root) on the source laptop machine, and then ssh to the remote PC machine to puppy@remotehost I still get the ssh session executing the root/Startup scripts.

The cause could be that you log in as root in the first place.
Just a guess, worth trying perhaps, make puppy the default automatic login, change this line in /etc/inittab from :
1:2345:respawn:/bin/login -f root tty6 </dev/tty1 >/dev/tty1 2>&1
to (change root to puppy):
1:2345:respawn:/bin/login -f puppy tty6 </dev/tty1 >/dev/tty1 2>&1
(and reboot, with changes saved)
Or, in case you use a login-manager, e.g. slim, set puppy to automatic login instead of root.

EDIT: Note also that DebianDog is not a true multi-user system by default, e.g. when logged in as root, you can login as puppy (enter password) (or other user) and to get back (from Desktop as puppy) as root is possible without entering password, just exit X and from console type "exit" and you are root again (and can type "startx" to get back to the Desktop as root).
With a display-manager (login-manager) installed such as slim, lightdm etc.., it's different, then it's a true multi-user system.

Fred

User avatar
ocpaul20
Posts: 33
Joined: Tue Jul 14, 2020 3:46 am
Location: PRC
Has thanked: 4 times
Been thanked: 1 time

Re: ssh anomaly perhaps or maybe I just dont understand

Post by ocpaul20 »

I think I should move the stuff to /etc/init.d anyway, but it is good to know what I need to do to boot as puppy. Thanks.

System: Fanless PC DebianDog Buster Frugal

Post Reply

Return to “DebianDogs”