This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: su alternative for Win2k

Jonathan Arnold wrote:

I was just installing postgreSQL and ran across the problem with getting initdb to run as the postgres user. As expected, I could neither su nor login to work. Searching the archives and the like for a fix, the most often specified one was to use ssh. But as I don't run sshd, and it seems a shame to have to run this just to get an su-like behaviour, that wouldn't work for me.

I finally hit upon the following solution. Maybe its in the archives, maybe not, but I thought I would post it (again?) to maybe save someone the hour or so I spent thrashing around the problem.

1] Create a shortcut to bash on your desktop

2] Now right-click on it and select Properties

3] Select the Shortcut tab and append the '-l' (that's dash el) to the Target: to make it be a login shell

4] a] Win2k : Select the "Run as different user" check box
   b] WinXP : click on the Advanced button and check "Run with
      different credentials"

Now when you click this shortcut, you will be prompted for the user to run bash as. Type in postgres and the password, and voila - you have a bash shell running as the selected user. Make running initdb and, just as importantly, createuser a piece of cake. Assuming, of course, you have the paths correct.

No need to go through all those steps. Just use runas (try runas /?). It's a Windows command that does essentially what you want from the command line.

This is as bad as it can get, but don't bet on it.

-- Unsubscribe info: Problem reports: Documentation: FAQ:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]