Hi,
I designed a plugin for our machine at work. The requirements for the plugin were it had to have a 'launch.sh' file and a file that would do the work (most the time it would be a perl or python script). The plugin works great, but the resulting file of the plugin needs to be moved to a shared windows server.
For that I've written the following.
Code:
#!/bin/bash
mount -t cifs //server/share /mnt -o user=domain/user,password=pass
cp /file /mnt/destination
unmount.cifs /mnt
I decided to attach the code above at the end of launch.sh to move the resulting file from the plugin to windows, but it gave me permission errors. Only 'mount' can be used with the root user.
So, I created a separate file called 'mount' with the code above in it and placed it in /usr/local/bin and gave it the permissions chmod 755.
At the bottom of 'launch.sh' I inserted the line...
Code:
sudo -u ionadmin mount
The error I get this time, isn't about permission issues it is...
Code:
sudo: no tty present and no askpass program specified
I realize this means that I didn't provide a password and therefore it couldn't do anything. I didn't mention this earlier, but the reason this process is so important is because the entire pipeline needs to be automated. (I can't run scripts as data comes off the machine...one input, one output)
I started to do some research on 'sudoers'. I'm not sure if I took this in the right direction, but I went into the sudoer file /etc/sudoers (using visudo) and wrote at the bottom ...
Code:
admin ALL=(ALL) NOPASSWD: /usr/local/bin/mount
I re-ran the script and ...
Code:
sudo: no tty present and no askpass program specified
the same error.
How can I automate this process? More specifically, how can I run mount as a root user within launch.sh?
Thanks in advance.
Bookmarks