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.



2008/06/04

... And ATI for Kernel

Today I've updated the kernel and guess what???? No working graphics (White screen but with the rotating cube)
Since I've got the official release and not the repositories version I don't know if this is a problem for all or it is just for those who have the same have version that I have installed or is just happening to me.
The solution is very simple. Just install the drivers again... and thats it.

2008/05/16

ZTE MF620 in linux

There is a how-to in Portuguese here

You need to install
- USB ModeSwitch
- Wvdial
- Gcom
- libusb

To install the first one open a terminal window and...
#wget http://www.draisberghof.de/usb_modeswitch/usb_modeswitch-0.9.2.tar.bz2
#tar -jxvf usb_modeswitch-0.9.2.tar.bz2
#cd usb_modeswitch-0.9.2
#./compile.sh
#
cp usb_modeswitch /usr/sbin/

The others you can find in the package manager

then edit
gedit /etc/wvdial.conf

and add this

[Dialer default]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
; Phone =
ISDN = 0
; Username =
Init1 = ATZ
; Password =
Modem = /dev/ttyUSB0
Baud = 460800
[Dialer tmn]
Init2 = ATZ
Init3 = AT+CGDCONT=1,"ip","internet"
Stupid Mode = 1
ISDN = 0
Phone = *99***1#
Ask Password = 0
Modem = /dev/ttyUSB0
Username = tmn
Dial Command = ATD
Password = "your_pin"
Baud = 460800

Next edit/create
/etc/usb_modeswitch.conf and add
DefaultVendor=0x19d2
DefaultProduct=0x2000
TargetVendor=0x19d2
TargetProduct=0x0001
MessageEndpoint=0x04
MessageContent="5553424308a0b7870000000000000600000000000000000000000000000000"


One more to edit
gedit /etc/udev/rules.d/15-zte-mf620.rules
with
ACTION!="add", GOTO="ZTE_End"
# Is this the ZeroCD device?
SUBSYSTEM=="usb", SYSFS{idProduct}=="2000",
SYSFS{idVendor}=="19d2", GOTO="ZTE_ZeroCD"
# Is this the actual modem?
SUBSYSTEM=="usb", SYSFS{idProduct}=="0001",
SYSFS{idVendor}=="19d2", GOTO="ZTE_Modem"
LABEL="ZTE_ZeroCD"
# This is the ZeroCD part of the card, remove
# the usb_storage kernel module so
# it does not get treated like a storage device
#RUN+="/sbin/rmmod usb_storage"
RUN+="/usr/sbin/usb_modeswitch -d 1 -v 0x19d2 -p 0x2000 -V 0x19d2 -P 0x0001"
LABEL="ZTE_Modem"
# This is the Modem part of the card, let's
# load usbserial with the correct vendor
# and product ID's so we get our usb serial devices
RUN+="/sbin/modprobe usbserial vendor=0x19d2 product=0x0001",
# Make users belonging to the dialout group
# able to use the usb serial devices.
#MODE="660", GROUP="dialout"
MODE="660", GROUP="tty"
LABEL="ZTE_End"


Now connect the device and do
#tail -f /var/log/messages

and wait until these lines are shown
.... [ 276.548000] usbserial_generic 2-2:1.0: generic converter detected
.... [ 276.548000] usb 2-2: generic converter now attached to ttyUSB0
.... [ 276.552000] usbserial_generic 2-2:1.1: generic converter detected
.... [ 276.552000] usb 2-2: generic converter now attached to ttyUSB1
.... [ 276.556000] usbserial_generic 2-2:1.2: generic converter detected
.... [ 276.556000] usb 2-2: generic converter now attached to ttyUSB2

after do
#/usr/sbin/usb_modeswitch -d 1 -v 0x19d2 -p 0x2000 -V 0x19d2 -P 0x0001
(not really necessary its just to confirm)

now do
#/usr/bin/gcom -d /dev/ttyUSB0

you will get something like this

SIM ready
Waiting for Registration..(120 sec max)

after the third dot appear press Ctrl+C waith for the led to turn on and run againg
#/usr/bin/gcom -d /dev/ttyUSB0

If something like this appears
SIM ready
Waiting for Registration..(120 sec max)
Registered on Home network:
Failed to register
you are good to go


now execute
/usr/bin/wvdial tmn

And if everything is working you'll get a internet connection.


...And now ubuntu

Since I'm little bit disappointed with opensuse and with KDE (The new KDE 4 does not work well) i will give a try to ubuntu, which someone said, it was/is the best gnome distribution.
At the moment I have managed to get everything to work well including compiz-fusion straight from the box.
The only problem that i found is the lack of a GUI for system configuration (Did not found one yet) but apart that it is working better than opensuse.
So for now I'll stick with ubuntu but keeping an eye in opensuse and see what happens.

2008/02/03

ATI and the "terror of" sax2

Everybody who as an ati graphics card knows that sometimes it is so hard to get it work with linux(At lest with suse), and if you have the (Bad) luck of having an old one, you can not use the proprietary drivers, instead, you must use the open source drivers, unless if you are using Xorg 7.0 or below. In this case only the version 8.28 or below will work.
The last proprietary version that worked well was the 8.40(for the most recent models) but it did not have AIGLX support. That support was later introduced with version 8.42, but the performance was poor, specially noted if you were using compiz-fusion. With the recent versions I did not saw any major improvements in performance with compiz-fusion, but openGL games (like Quake) got much better, that means that compiz-fusion will have to wait.
Downloading the proprietary drivers and then installing in opensuse 10.3 must be done with care. You need to uninstall any previous version and only than install the new one. After that comes the problem because, every time that I use sax2 command, it gives the no 3d support error. I've tried to follow ati instructions but had no success, the only thing that works is not using sax2 but use the aticonfig only. The catch is that with sax things seems to work better, so, instead of using the downloaded proprietary drivers you can always use the version that exist in the repositories. For me this is the best solution because it is easier to install and work with sax. The other problem with the drivers is that there is additional manual configuration to put things running smoothly. I'm hoping that the next version of sax comes with some kind of solution for this problem, because many users quit using linux when many manual configuration is needed.