How do I run cygwin commands when sshd is started up?

0

I am using net use commands in a .profile for an sftp client to access file shares from cygwin.

If I ssh to the Windows server and run . .profile, then everything works until the next time the server is reboot.

Is there a way at sshd startup to run a script like a .profile?

Seth Fishman

Posted 2016-06-07T00:38:11.807

Reputation: 1

net use is not a cygwin command, it is a Windows command line command. – DavidPostill – 2016-06-07T09:12:49.547

Wow... you really butchered your own post with your first edit. Bunch of potentially useful details gone. It looks like sshd is being started by a Windows service. If you check the properties of that service, what is the exact "Path to executable"? (In other words, what is the entire command line that gets run in order to start sshd?) I'm suspecting that info may help show us some rather easy options. (Or, changing that info, via Reg key changes, might provide some options.) – TOOGAM – 2016-06-07T21:36:09.513

Path to executable is: C:\cygwin64\bin\cygrunsrv.exe It's just a standard cygwin install on windows. – Seth Fishman – 2016-06-07T23:14:07.450

Sorry for butchering my original post: Here's what's in .profile: net use P: /delete, net use P: '\mysrvr\myshare' /user:myuser mypwd /PERSISTENT:YES. Now this gets invoked in .profile when I ssh to the box and run this command: . .profile HOWEVER: When the box is reboot, the .profile does not run during startup so the file share isn't there. If someone could help me figure out how to fix this so that the startup simulates: 1) ssh to the server, 2) run the command . .profile, I would REALLY appreciate it! – Seth Fishman – 2016-06-09T17:28:17.817

No answers