Дать право на изменение файла определенному пользователю
while read p; do
echo "$p"
done </путь/к/файлу/мой_файл.txt
Встречаю в примерах кода, что люди хранят в базе помимо самого хеша, значение соли. Зачем?
const ADMIN = 0b11111111
const CAN_DELETE = 0b00001000
const CAN_EDIT = 0b00000100
const CAN_WRITE = 0b00000010
const CAN_READ = 0b00000001
const REGULAR_USER = CAN_WRITE | CAN_READ
const ANONYMOUS = CAN_READ
const BANNED = 0b0
const MODERATOR = REGULAR_USER | CAN_EDIT | CAN_DELETE
class User {
constructor(name, mask) {
this.name = name;
this.mask = mask;
}
}
const users = [
new User('admin', ADMIN),
new User('moder', MODERATOR),
new User('regular_user', REGULAR_USER),
new User('anon', ANONYMOUS),
]
users.forEach( u => {
console.log(u.name);
if ((u.mask & ADMIN) === ADMIN) {
console.log('\t ADMIN');
}
if ((u.mask & MODERATOR) === MODERATOR) {
console.log('\t MODERATOR');
}
if ((u.mask & REGULAR_USER) === REGULAR_USER) {
console.log('\t REGULAR_USER');
}
if ((u.mask & CAN_EDIT) === CAN_EDIT) {
console.log('\t CAN_EDIT');
}
if ((u.mask & CAN_DELETE) === CAN_DELETE) {
console.log('\t CAN_DELETE');
}
if ((u.mask & CAN_WRITE) === CAN_WRITE) {
console.log('\t CAN_WRITE');
}
if ((u.mask & CAN_READ) === CAN_READ) {
console.log('\t CAN_READ');
}
});
admin
ADMIN
MODERATOR
REGULAR_USER
CAN_EDIT
CAN_DELETE
CAN_WRITE
CAN_READ
moder
MODERATOR
REGULAR_USER
CAN_EDIT
CAN_DELETE
CAN_WRITE
CAN_READ
regular_user
REGULAR_USER
CAN_WRITE
CAN_READ
anon
CAN_READ
echo 'cd /addons/sourcemod/plugins && mput /home/sm/compiled/smxfile.smx' | lftp user:pass:pass@ip
scp /мой/файл user@ip:/куда/заливать/ -i ~/.ssh/мой_ключ