Showing posts from 2014

create a samba share and user

I found a lot of posts intended to explain how to create a samba share and user that would work even connecting from a Windows box. Unfortunately lot of these tuto's simply do not work. I was able to do the job this way: #this creates the user in linux sudo useradd -s /bin/true (username) #this will prompt you for a password sudo smbpasswd -L -a (username) #this enables the user sudo smbpasswd -L -e (username) #creates new samba user sudo smbpasswd -a (username) #add username to smbusers file sudo nano /etc/samba/smbusers (linuxusername) = '(username)' #restart samba sudo restart smbd sudo restart nmbd   #Then create a samba share: [share_name] path = /path/to/share read only = no writable = yes guest ok = no create mask = 0755 directory mask = 0755 valid users = username #Where the username is the username just above created

Scheduled updates with cron job

If you want to install updates on a server you may want it done at night when users are sleeping (hopefully). That is not that difficult with a shell script and a cron job . The shell script takes care of calling all the update commands and the cron job schedules the executing and log the output to a custom log file. First the shell script: #!/bin/sh echo "\nUpdate on: $(date)\n" echo 'Update the packages list\n' sudo /usr/bin/apt-get update >> /dev/null 2>&1 echo '\nUpgrade to latest package version\n' sudo /usr/bin/apt-get upgrade --yes echo '\nUpgrade the distribution\n' sudo apt-get dist-upgrade --yes echo '\nCleanup\n' sudo /usr/bin/apt-get autoremove --yes sudo /usr/bin/apt-get autoclean --yes sudo /usr/bin/apt-get clean --yes # # The End # The script executes after all a bit of cleanup. Put the "" script in a folder and make it executable: $ chmod +x Now the cron job rule: open