Its quite easy to manage users with the cmd tools and here are some examples:

- Create user:
adduser user1

- Create a group:
groupadd group1

- Add user to group:
usermod -a -G ftp user1 (added to group ftp)

- Change password or force a bad password:
passwd user1 (logged in as root changing user1 pw)
passwd (type it as logged in as the user)

Screen, köra program i bakgrunden

Om man vill att ett program som man startar via ssh-login ska fortsätta köra trots att man loggar ut eller om man vill kunna köra flera program på 1 ssh-inloggning.
Använd då screen.

- Installera screen via ex. dfn
dnf install screen

- Starta ett program, ex. en TF2-server där vi har ett startscript som heter start_tf2 och denna screen-session kallar vi tf2.
screen -mdS tf2 ./start_tf2

- För att gå till ovanstående screen-session.
screen -r tf2

Skydda webb-mapp med lösenord

Har man tillgång till root login på en Unix-server så är det lätt.

- Gå in i den mapp som ska skyddas:
cd /var/www/html/www/mypwmapp

- Skapa .htaccess filen, spara och exit.
vi .htaccess

- Sätt lösen & spara i en mapp som inte nås från webb och vanliga användare.
htpasswd -c /etc/httpd/webb-passwd username

- Om du ska lägga till ytterligare en användare så använd inte -c då det raderar den gamla filen och gör 1 ny.
htpasswd /etc/httpd/webb-passwd more-username

Connect with ssh from 1 server to another

This is quite easy but as I don't use it every day-more likely once a year..

After connecting to the first server with ex. Putty we need to know some stuff about server2

User that have access to ssh
Witch IP the server have
Witch port ssh is bound to on server 2

We say User= user, Ip=, port=225

When we do it as this

ssh user@ -p 30

How to fix a dead network connection on fedora 26 in 2 examples

I have one server that refuse to have a functioning network connection after a restart.

I can ping out and some http seems to work, but not as it should, but here is how I solved it the last two restarts.

/etc/init.d/network stop

systemctl restart NetworkManager

Now it should work but if it doesn't work you can try this way:

Do this command: ifconfig
Now you can see the configurations of all network cards on the computer.
In the beginning you can see the network-cards name here is an ex.

Howto mount a new disk and get it running

This is a short ex how this can be done on a fedora machine

After connecting it and if its under /dev/sdd1 its like this

mkfs -t ext2 /dev/sdd1

Check if its done
fsck -f -y /dev/sdd1

Mount it
mount /dev/sdd1 /mnt/newdrive

Mariadb fail to start after update

This has happend twise now in a year and isnt any good..

- they had change the location of mysql.sock and I solved it by doing a link from the new place to the old.

ln -s /run/mysqld/mysql.sock /var/lib/mysql/mysql.sock

- they missed to set right owner of /var/run/mysqld and I did just change it to right owner.

chown -Rf mysql:mysql /var/run/mysqld

Change owner of files/maps/links

How to change owner of files or directory.

chown user:user /home/user/music.txt
if you are in the same directory you can use:
chown user:user music.txt

Change owner of directory and all files in it:
chown -R user:user /home/user/music

Change owner of a sybolic link:
chown -h user:user /home/user/music


Firewalld är en kraftfull brandvägg som kan stoppa trafik både in & ut, man kan ange service-namn eller portar mm.

För att se om Firewalld är aktivt:
firewall-cmd --state

För att se vilken "zone" eller profil som just din dator använder
firewall-cmd --get-default-zone

För att få en lista på alla regler som är laddade under den aktiva profilen:
firewall-cmd --zone=FedoraServer --list-all

Zip / Tar ..... howto pack and extract

Its quite easy when you know the syntax, but think so you dont overwrite or delete.


To compress a directory with zip do the following:

# zip -r directory_to_compress

Here’s how you extract a zip archive:

# unzip


Here’s how you compress a directory:

# tar -cvf archive_name.tar directory_to_compress

And to extract the archive:

# tar -xvf archive_name.tar.gz



Subscribe to RSS