I have an Ubuntu server that is joined to our windows domain. Users login via SSH using AD creds. I have a script that allows me to mount a windows share using cifs.
sudo mount.cifs //server/$1 /home/DOMAIN/$1/D -o user=$1,uid=$1,gid=domain\ users
I then have this entered in my /etc/bash.bashrc
#If ~/D does not exist, create it
if [ ! -d ~/D ]; then
mkdir ~/D
fi
#Mount D drive to ~/D
sudo /usr/local/bin/mountsamba.sh $USER
What I am trying to do is get it so it doesn't ask for the password and just uses the credentials that I use for logging into the server.
I actually got it figured out. Install keyutils and created this bash script:
BASH
sudo mount -t cifs //tiberius/$1 /home/NTGROUP/$1/D -o user=$1,cruid=$1,sec=krb5,uid=$1,gid=domain\ users
Then I added this into /etc/bash.bashrc
BASH
#If ~/D does not exist, create it
if [ ! -d ~/D ]; then
mkdir ~/D
fi
#Mount D drive to ~/D
sudo /usr/local/bin/mountsamba.sh $USER
Then in /etc/sudoers, I have:
BASH
ALL ALL=(root) NOPASSWD: /usr/local/bin/mountsamba.sh