cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

xp_cmdshell; does it work from linux?

Former Member
10,297

Does xp_cmdshell access the Linux shell as well as the windows shell as appropriate depending on the base system? If so which linux shell is accessed and does this require configuration? I am attempting to run a privileged linux command (requiring SUDO) from a SQL Anywhere script running in ISQL. I am attempting to determine which version of askpass is required for the SUDO -A environment variable. OpenSuSE 12.3 installs the x11 version by default; it does not work or I have configured it improperly. I am running Gnome and there is a gnome (and kde3 I believe I do not need) version of askpass that could work; I will be trying the gnome version next.

I have read the DCX help and there was no discussion of specific linux actions.

Thanks

View Entire Topic
MarkCulp
Participant

Yes, xp_cmdshell works on all platforms that SQL Anywhere is supported. On Linux and all Unix platforms xp_cmdshell emulates system(3): it spawns /bin/sh (/usr/bin/sh on some platforms) and passes the given command.

Note that your xp_cmdshell() request will be executed by the database server not ISQL and therefore xp_cmdshell command will be given the same permissions that are given to the server. Depending how you are running your server (e.g. running as a service / daemon?) the command may not have rights to interact with the terminal or console user - i.e. there may not be an attached TTY. I.e. in your specific case the 'askpass' program may not be able to ask the attached user for their password.

Former Member
0 Likes

Thanks for the info -- you gave me some ideas to try to make this work. If I understand your comment running a personal server from the desktop may have the better chance to give me the needed access to get a password prompt from the command.