Archive for the ‘Red Hat / CentOS’ Category

Reboot linux at specific time

August 13th, 2019 No comments

Sometimes you want to reboot a server in the middle of the night. With linux it’s as simple as this command:

shutdown -r 04:00

Which will reboot the machine at 4 am in the morning. If you need to abort the reboot, use the following to abort the reboot:

shutdown -c
Categories: Bash, Linux, Red Hat / CentOS, Ubuntu Tags:

Install Citrix Receiver in Fedora 16 (x64)

May 29th, 2012 No comments

Download the Citrix Receiver client from Citrix homepage. You should be redirected there automatically when trying to access Citrix applications portal.

This was the URL in my case:

This is another URL to get the Citrix Receiver:

After the installation (download and install the rpm-package) check where your Netscape plugin folder is:

$ sudo find / -name plugins | grep -i "netscape\|firefox\|mozilla"
$ cd /usr/lib64/mozilla/plugins

Then check where your so module is:

$ sudo find / -iname *npica* -type f
$ sudo ln -s /opt/Citrix/ICAClient/

Install a missing dependency (because of 64-bits Fedora):

$ sudo yum install

The first time you click on an application, your browser is likely going to popup a dialog box giving you the choice to open the file or save the file. Choose the option to open the file. Where it asks for the application to use on this type of file, type in the path to the wfica application:


In my case I got error 61 because I hadn’t the certificate for “ Secure Server Certification Auth…”. To get in I used a Win7 computer, Internet Explorer 9, menu “Tools / Internet Options / Innehåll” / Certificates-button / “Betrodda rotcertifikatutfärdare”, mark the cert you want to export, click “Export”-button, save as “DER-encoded binary x509 file (.cer)”. I then copied this file into the folder: /opt/Citrix/ICAClient/keystore/cacerts

Or you can use “OpenSSL” to convert a PEM certificate exported from Firefox in Linux:

$ sudo openssl x509 -in /home/user/Downloads/exported_cert -inform PEM \
-out /opt/Citrix/ICAClient/keystore/cacerts/my_citrix.crt -outform DER





Categories: Linux, Red Hat / CentOS Tags:

Change login background in Fedora 16

March 16th, 2012 No comments
Categories: Linux, Red Hat / CentOS Tags:

Lägg upp en skrivare i CentOS/RHEL

October 19th, 2010 No comments

This will add a HP JetDirect printer:

lpadmin -p printername -v socket://ipaddress_of_printer:9100

CUPS provides two methods for adding printers: a command-line program called lpadmin(8) and a Web interface. The lpadmin command allows you to perform most printer administration tasks from the command-line and is located in /usr/sbin. The Web interface is located at:

and steps you through printer configuration. If you don’t like command-line interfaces, try the Web interface instead.

Run the lpadmin command with the -p option to add a printer to CUPS:

    /usr/sbin/lpadmin -p printer -E -v device -m ppd ENTER

For a HP DeskJet printer connected to the parallel port this would look like:

    /usr/sbin/lpadmin -p DeskJet -E -v parallel:/dev/lp1 -m deskjet.ppd ENTER

Similarly, a HP LaserJet printer using a JetDirect network interface at IP address would be added with the command:

    /usr/sbin/lpadmin -p LaserJet -E -v socket:// -m laserjet.ppd ENTER

As you can see, deskjet.ppd and laserjet.ppd are the PPD files for the HP DeskJet and HP LaserJet drivers included with CUPS. You’ll find a complete list of PPD files and the printers they will work with in Appendix C, “Printer Drivers”.

For a dot matrix printer connected to the serial port, this might look like:

    /usr/sbin/lpadmin -p DotMatrix -E -m epson9.ppd \
        -v serial:/dev/ttyS0?baud=9600+size=8+parity=none+flow=soft ENTER

Here you specify the serial port (e.g. S0,S1, d0, d1), baud rate (e.g. 9600, 19200, 38400, 115200, etc.), number of bits, parity, and flow control. If you do not need flow control, delete the “+flow=soft” portion.

The CUPS web server provides a user-friendly “wizard” interface for adding your printers. Rather than figuring out which device URI and PPD file to use, you can instead click on the appropriate listings and fill in some simple information. Enter the following URL in your web browser to begin:

Click on the Add Printer button to add a printer.


Tips how to troubleshoot a deskjet printer in Ubuntu:

Categories: Linux, Red Hat / CentOS Tags:

Felsökning nätverk och WWW tjänst

October 19th, 2010 No comments
Verify it’s not a connection issue: Try to ping.
On the host when the interface is up do a ethtool eth0
If it is autoneg you should see a speed and duplex. Also the link at the bottom should say yes.
Do a tcpdump -i eth0 and make sure you can see traffic of any kind.
Then check if firewall is active with this command
service iptable status
The outpur should contain:
12   ACCEPT     tcp  —             state NEW tcp dpt:80
15   ACCEPT     tcp  —             state NEW tcp dpt:443
(12 and 15 are the sequence numbers and could be different than the numbers listed here)
Please check both boxes for /etc/sysconfig/iptables and see if both have these:
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 443 -j ACCEPT
If not add these lines and restart firewall:
service iptables restart
Troubleshoot the Apache daemon. Check if it is working with these commands:
netstat -anpt | grep http
Do you see anything like :
tcp        0      0 :::80                       :::*                        LISTEN      3717/httpd
tcp        0      0 :::443                      :::*                        LISTEN      3717/httpd
in the output?
If not please try to restart the daemon :
service httpd restart
If this fails please check the output from :

Categories: Linux, Red Hat / CentOS Tags:

Starta skript vid inloggning

October 19th, 2010 No comments
This is an example how to execute a script at logon to set the Java environment. Add a script named “” to add the variable in /etc/profile.d/ (with “execute” permissions) if you’re using bash as login shell:
export JAVA_HOME=/usr/java/j2k1.x.x
export PATH=$PATH:$JAVA_HOME/bin
The contents of profile.d will be automatically executed with every interactive logon.
When you logoff your shell will be removed from the memory along with the entire environment. But when you logon again it will be reestablished including your new java environment.
Categories: Linux, Red Hat / CentOS Tags:

Utföra adminkommandon som användare i CentOS

October 7th, 2010 No comments

You can configuring ‘sudo’ by typing ‘visudo’ to edit the people who can use the sudo command and which commands they can run with sudo.

Some examples :

For example you could say that a user (red15) is allowed to call ‘sudo <any program>’ but he will have to identify himself with a password then :
red15 ALL=(ALL) ALL

Or you could say user (red15) is allowed to execute a program /usr/bin/ls without having to give his password:
red15 ALL=(ALL)NOPASSWD:/usr/bin/ls

Or you could say our user is allowed to run /usr/bin/ls but only as another user (not root for example):
red15 ALL=(other_user)NOPASSWD:/usr/bin/ls

Check out the offical man pages for more info about sudo.

As a side note, try running “su – “. The ” – ” option tells the computer to also load the profile and enviroment variables for the root user, which might be needed by your administration scripts.

Categories: Linux, Red Hat / CentOS Tags:

Installera trådlöst wifi i CentOS

September 28th, 2010 No comments

Install pro/wireless 3945abg on Linux Centos

Check that you have the wireless card:

# ifconfig -a

wlan0     Link encap:Ethernet  HWaddr 00:ED:3C:57:F3:DC
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Then look in the following links:

Categories: Linux, Red Hat / CentOS Tags:

Fjärrstyra en Ubuntu server via VNC

September 8th, 2010 No comments

To remote control a Linux server, you really only need SSH access.

But if you need GUI access, for security, I would either use X11 forwarding through a SSH session or set up VNC tunneled through SSH.

For X11-forwarding, you need to edit the /etc/ssh/sshd_config file to allow it and just SSH in with:

 ssh -X user@host

For tunneling VNC through SSH, the best tutorial/how-to is probably using x11vnc and ssvnc:

With this setup, you don’t have a VNC server running all the time so not just anyone can connect.  When you run ssvnc (or sshvnc), it connects to the server through SSH and then starts the VNC server listening only on localhost and connects to that server.  When you log out of your SSH session, it kills the running VNC server.  All in all much more secure this way if the X11 forwarding won’t work for you.

If you’d like to run VNC all the time

Read how to use x11vnc here:

“Typical usage is:

Run this command in a shell on the remote machine “far-host”
with X session you wish to view:

 x11vnc -display :0

Then run this in another window on the machine you are sitting at:

 vncviewer far-host:0

Once x11vnc establishes connections with the X11 server and starts listening
as a VNC server it will print out a string: PORT=XXXX where XXXX is typically
5900 (the default VNC server port).  One would next run something like
this on the local machine: “vncviewer hostname:N” where “hostname” is
the name of the machine running x11vnc and N is XXXX – 5900, i.e. usually
“vncviewer hostname:0”.

By default x11vnc will not allow the screen to be shared and it will exit
as soon as the client disconnects.  See -shared and -forever to override
these protections.  See the FAQ for details how to tunnel the VNC connection
through an encrypted channel such as ssh(1).  In brief:

 ssh -t -L 5900:localhost:5900 far-host 'x11vnc -localhost -display :0'
 vncviewer -encodings 'copyrect tight zrle hextile' localhost:0

Also, use of a VNC password (-rfbauth or -passwdfile) is strongly recommended.

For additional info see:

Regards, Tobias

Remote CentOS X from Windows via SSH

Run yum install vnc.

Another option is to use an X-windows with PuTTY/SSH client and configure the  X11 display to redirect for the SSH connection.

cygwin might be an option to explore ( )
What it will do is that once you establish an SSH connection from the windows 7 to the linux system with the X11 tunnel, you can then run the graphic commands on the linux and it will be redirected back through the SSH connection.
When in the SSH session on the linux, echo $DISPLAY to make sure it is set.

Categories: Linux, Red Hat / CentOS, Ubuntu Tags:

Uppgradera Red Hat

September 7th, 2010 No comments

One way is to stuck the RH5 Installation DVD in and go through the installation process but select upgrade instead of install a new system.

Another way is to use the yum groupinstall function to pick what you need:

1) first make sure you have yum-utils
# yum install yum-utils

2) check out the groups:
# yum grouplist

3) install a group:
# yum groupinstall “Web server”

4) Further, to know details of what each group means, use groupinfo, like:
#yum groupinfo “Java Development”

Categories: Linux, Red Hat / CentOS Tags: