ONTAP Discussions

Cygwin Issue with Windows group names

kaye1
3,951 Views

Hi

 

We use Windows server as admin consoles for our NetApp controllers, when running scripts on 7-mode we still use rsh. Due to a recent upgrade of Server 2008 R2 to 2012 R2 we have deployed Cygwin64 for use as a shell to run rsh commands against our 7-mode controllers. All is well apart from the issue the UNIX shell has with certain domain names with characters and spaces.

 

When running a script to setup for e.g. a CIFS share access change, I’d use the cmd /c syntax with a path to the cmd file

 

Within the cmd file a few lines as an example to show the error received in Cygwin

 

rsh FilerA cifs shares -add testadmin$ /vol/qtree

rsh FilerA cifs access testadmin$ '#Storage Admin' full

rsh FilerA cifs access testadmin$ 'Domain Secur' change

 

 Example shown of the standard error Cygwin displays

C:\cygwin64\>rsh FilerA cifs access  testadmin$ '#Storage Admin' full

 

Usage:

         cifs access <share> [-g] <user|group> <rights>

         cifs access <share> -m

         cifs access -delete <share> [-g] <user|group>

         cifs access -delete <share> -m

                 rights can be Unix-style combinations of r w x -

                 or NT-style "No Access", "Read", "Change", and "Full Control"

 

 

C:\cygwin64\>rsh FilerA cifs access  testadmin$ 'Domain Secur' change

Unknown user/group DOMAIN

 

Would anyone be able to help with the # character and a name with spaces? I tried various different methods with changing the syntax including using a \ before a space and a + in place of to no avail .

I'm unable to have these names changed at all and I’m seeking a work around.

1 ACCEPTED SOLUTION

asulliva
3,941 Views

Obligatory "why not move to ssh?!" comment...

 

Also, you could use the NetApp PowerShell Toolkit as a wrapper here:

 

Connect-NaController FilerA
Invoke-NaSsh "cifs shares -add testadmin$ /vol/qtree"
Invoke-NaSsh "cifs access testadmin$ '#Storage Admin' full"
Invoke-NaSsh "cifs access testadmin$ 'Domain Secur' change"

 

Would get you away from having to use the Cygwin environment...too many layers of abstraction make for stranage errors and reliablity begins to suffer.

 

That being said, try putting single or double quotes around the command(s):

 

rsh FilerA "cifs shares -add testadmin$ /vol/qtree"
rsh FilerA "cifs access testadmin$ '#Storage Admin' full"
rsh FilerA "cifs access testadmin$ 'Domain Secur' change"

If the command has the same type of quote you're using to wrap it then you'll need to escape them...I think back slash ("\") works, but it's been a while.

 

Hope that helps.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

2 REPLIES 2

asulliva
3,942 Views

Obligatory "why not move to ssh?!" comment...

 

Also, you could use the NetApp PowerShell Toolkit as a wrapper here:

 

Connect-NaController FilerA
Invoke-NaSsh "cifs shares -add testadmin$ /vol/qtree"
Invoke-NaSsh "cifs access testadmin$ '#Storage Admin' full"
Invoke-NaSsh "cifs access testadmin$ 'Domain Secur' change"

 

Would get you away from having to use the Cygwin environment...too many layers of abstraction make for stranage errors and reliablity begins to suffer.

 

That being said, try putting single or double quotes around the command(s):

 

rsh FilerA "cifs shares -add testadmin$ /vol/qtree"
rsh FilerA "cifs access testadmin$ '#Storage Admin' full"
rsh FilerA "cifs access testadmin$ 'Domain Secur' change"

If the command has the same type of quote you're using to wrap it then you'll need to escape them...I think back slash ("\") works, but it's been a while.

 

Hope that helps.

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

kaye1
3,902 Views

Hi Andrew - thanks for responding. Double quotes was what I was looking for, I used single quotes to wrap the group names and never even thought to use double around entire command. Now tried it works a treat.

We do use ssh just this legacy way of running a script for 7-mode has hung around we were advised to use cygwin as an alternative but your comments will certainly be noted.

Thanks again

Kaye

Public