Use chmod command rather than sftp.chmod

For some reason chmod doesn't work unless we execute as root,
so just execute the command remotely on the server.
Convert slots to int before templating