TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:2116] execute but not read
In a message dated 98-11-07 19:39:17 EST, you write:
<< I am trying to setup printing to a remote printer via netware. According
to the printing how-to I need to create a script that runs nprint with the
right server, username, and password. I created this script in
/usr/local/bin. Because the script contains my netware password, I want to
make the file executabke to all (so anyone can print) but not readable.
I did chmod 771 on the file, but then users couldn't run it. only when I
added chmod a+r to the file did execution work again. How can I hide my
password? >>
You could write a C program wrapper that executes nprint with your password
using the system command such as and mark that only as the executable. It is
crude and will crash if the argument list exceeds 1024 characters but should
work otherwise.
I am sure there are better ways of doing this though !
Compile with
gcc mynprint.c -o mynprint
--
#include<stdio.h>
main(int argc, char **argv )
{
int cnt;
char command[1024];
/* Make sure that nprint path is correct and also set the user and
password
* names to whatever they are
*/
strcpy( command, "/usr/bin/nprint -U lueyb -P not4you " );
/* Add the other options that you need passed to it. */
for( cnt=1;cnt<argc;cnt++) {
strcat( command, " " ); /* separate the options with blank
spaces. */
strcat( command, argv[i] );
}
/* Run the command. */
system( command );
}