SFTP is an easy way to offer secure FTP-like access without any additional software. All mechanism bases on SSH server.
Let’s create a group for all SFTP users. For example “sftp-only”.
# addgroup sftp-only
And add users (for example joe) to that group.
# adduser joe sftp-only
Sometimes we need limit the access to some system resources or files. We want to be sure that the only one process to have an access to them in the same time. This short article explains how to use exclusive locks in shell scripts.
Assume we have a shell script (‘writer.sh‘) which writes an output file (‘output.txt‘). It writes the file line by line with one second delay between each line.