2016/05/10

How to use autofs to mount a network drive/folder

Autofs lets you mount a network drive/folder automatically without fiddling with fstab.

Firts add a file to the root home folder with the credentials to access that network folder. We named our file credentials.txt, than add:

username="the username"
password="the password"

Next add to the folder etc/auto.master.d a file with the following code 

share1 -fstype=cifs,rw,noperm,credentials=/root/credentials.txt ://path to the source folder

We named this file as share1

Add another file to the same folder but with an extension .autofs and add the following code

/path to the destination folder  /etc/auto.master.d/share1 --timeout=60 --ghost

We named this file as share1.autofs

Now we need to enable autofs to run at boot time
On a terminal type (you need elevated privileges)

systemctl enable autofs.service

Now reboot or type on a terminal

systemctl start autofs.service

2016/05/09

VNC server for multiple clients/logins

This was tested with CentOS 7 and Gnome 3.20

This is a way to have a VCN server with multiple logins without having to configure a session for each user

What you need:
  • TigerVNC
  • Xinetd
  • xorg-x11-fonts-type1 (optional)
  • XDMCP/GDM

Edit /etc/gdm/custom.conf and add or change the following

[security]
  AllowRemoteRoot=true
  DisallowTCP=false

[xdmcp]
  Enable=true
  MaxSessions=30



Add a file named vncserver or something else to /etc/xinetd.d/ with the following code:

service vncserver This is the name of the service and can be whatever we want
{
  disable = no
  socket_type = stream
  protocol = tcp
  group = any group that exist
  wait = no
  user = nobody
  server = /user/bin/Xvnc
  server_args = -inetd -once -query localhost -geometry 1920x1080 -depth 24 -securitytypes none -desktop VNC-Remote-Access
  log_on_failure += USERID
}


geometry is the screen resolution
Depth is color depth and can be 8, 16, 24.
Restart Xinetd

Create VNC service by adding the following to the end of the file /etc/services

 vncserver 5900/tcp # VNC and GDM

Add firewall rules to allow the VNC connection

[root@server ~]# firewall-cmd --permanent --zone=public --add-port=5900/tcp
[root@server ~]# firewall-cmd --reload

And reboot.