Latest Publications

RHEL 7 / CentOS 7 / Grub2 : Protect Single User Mode / Rescue / Emergency with Password

Hello All,

As we all know Red Hat Enterprise Linux 7 and CentOS 7 Linux is out now, Recently I have posted How to enter into Single User Mode / Rescue / Emergency Mode on RHEL 7 / CentOS 7.

This post is to Secure Single User Mode / Rescue Mode / Emergency mode on RHEL 7 / CentOS 7 in Grub2, By performing this Article you will able to secure your Grub2 Edits with Username and Password, It is always a good idea to protect your Grub2.

In This Howto, We will protect Grub2 with Encrypted Password and Plain Password.

To Follow this how to make sure you have root password to make changes in Grub2, Please make sure you are doing exact as per instructions and going through notes.

Do this on your own risk, You will be the only responsible if anything goes wrong in any case :)

 

CentOS7_Grub2

CentOS7_Grub2

 

Protect Grub2 with Plain Password Method

1. Login as a root user or user with rights to edit grub2 configuration file (sudo).
su -

2. Make a backup of existing grub.cfg and default /etc/grub.d/10_linux so if anything goes wrong we can always restore it.

# cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig
# cp /etc/grub.d/10_linux /etc/grub.d/10_linux.orig

3. Now, Adding Entries to protect Grub2 with username and password:

Note1: Replace Username and Password from below lines and Add below lines at last in file /etc/grub.d/10_linux

Note2: Make sure you don’t insert following entries multiple time.

# vi /etc/grub.d/10_linux

cat << EOF
set superusers=”tejasbarot” 
password tejasbarot alub@123
EOF

4. Now let us Generate New grub.cfg, Execute following command.

# grub2-mkconfig –output=/tmp/grub2.cfg

5. Now Replace this New configured grub2.cfg with existing grub2.cfg

# mv /boot/grub2/grub.cfg /boot/grub2/grub.cfg.move

# mv /tmp/grub2.cfg /boot/grub2/grub.cfg

6. That’s It, Now You can reboot and Press “e” on Grub Menu, It will ask you for the password.

Protect Grub2 with Encrypted Password Method

1. Login as a root user or user with rights to edit grub2 configuration file (sudo).
su -

2. Make a backup of existing grub.cfg and default /etc/grub.d/10_linux so if anything goes wrong we can always restore it.

# cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig
# cp /etc/grub.d/10_linux /etc/grub.d/10_linux.orig

3. Let’s Generate Encrypted password with “grub2-mkpasswd-pbkdf2″, Once you will execute below command it will ask you for the password, Please enter password twice, It will generate password string which you need to add to 10_linux file. ( Shortened version of string, You will have to paste full )

# grub2-mkpasswd-pbkdf2
Enter Password:
Reenter Password:
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.F1C4CFAA5A51EED123BE8238C23B25B2A6909AFC9812F0D45

4. Now, Adding Entries to protect Grub2 with username and password:

Note1: Replace Username and Password from below lines and Add below lines at last in file /etc/grub.d/10_linux

Note2: Make sure you don’t insert following entries multiple time.

Note3: Here I have added Short String for example, you will have to add full string to make it work.

# vi /etc/grub.d/10_linux

cat << EOF
set superusers=”tejasbarot” 
password_pbkdf2 tejasbarot grub.pbkdf2.sha512.10000.F1C4CFAA5A51EED123BE8238C23B25B2A6909AFC9812F0D45
EOF

5. Now let us Generate New grub.cfg, Execute following command.

# grub2-mkconfig –output=/tmp/grub2.cfg

6. Now Replace this New configured grub2.cfg with existing grub2.cfg

# mv /boot/grub2/grub.cfg /boot/grub2/grub.cfg.move

# mv /tmp/grub2.cfg /boot/grub2/grub.cfg

7. That’s It, Now You can reboot and Press “e” on Grub Menu, It will ask you for the password.

Enjoy Protected Grub2 :) Enjoy CentOS 7 :) Enjoy RHEL 7 :) Enjoy Linux :) Enjoy Open Source :)

Content Protection by DMCA.com

[Solved] Skype 4.2.x Linux : Can’t Connect | Ubuntu 12.04 / Ubuntu 14.04 LTS

Hello All,

Today Morning, I started my Laptop and Logged in to My Ubuntu 14.04.1 LTS box and tried to Login in to Skype with same credentials, Skype thrown Error was “Can’t Connect”.

I managed to solve this error so sharing this error’s solution which might helps you.

This Error’s solution is very simple but very weird and complicated to find it out, I have find it out by just guessing the things.

skype 4.3 for Linux

skype 4.3 for Linux

I Just went to Skype’s Website and Checked that Latest Version was there so I gave it try and Updated New Version, After updating version of Skype, I am able to login successfully without any problem.

Get the Latest Version of Skype 4.3 For Linux from here http://www.skype.com/en/download-skype/skype-for-computer/

and Install it by using following Command :-

tejas-barot@skype-ubunt-14-04-lts:~$ sudo dpkg -i skype-xxx-xx.deb

I was using Skype’s Version 4.2.x for Linux, I have updated version to 4.3.0.37 and this solved my problem.

This is very simple Solution to the problem but very weird to find it out so Sharing with you guys.

Enjoy Skype Calls :) Enjoy Ubuntu :) Enjoy Linux :) Enjoy Open Source :)

Content Protection by DMCA.com

RHEL 7 / CentOS 7 : Recovering / Reset Root Password

Hello,
Setting up the root password is a mandatory part of the Red Hat Enterprise Linux 7 / CentOS 7installation.
If you forget or lose your password, it is possible to reset it. Now it is known as Rescue Mode / Emergency mode in CentOS / RHEL 7, Previously in RHEL / CentOS 5/6 It was “Single User Mode”.
Note: In GRUB 2, resetting the password is no longer performed in single-user mode as it was in GRUB included in Red Hat Enterprise Linux 6. The root password is now required to operate in single-user mode as well as in emergency mode.
systemd_recover_root_password

systemd_recover_root_password

Process: Resetting the Root Password
  1. Please follow this procedure carefully, any mistake can make your system / Linux unstable, Perform this own your on risk.
    q
  2. Start the system and, on the GRUB 2 boot screen, press the e key for edit.
  3. Add the following parameter at the end of the linux line, or linuxefi on UEFI systems:
    init=/bin/sh
    The Linux kernel will run the /bin/sh shell rather than the system init daemon. Therefore, some functions may be limited or missing.

    Important

    The rhgb and quiet parameters must be disables in order to enable system messages.
  4. Press Ctrl+x to boot the system with the parameter.
    The shell prompt appears.
  5. The file system is mounted read-only. You will not be allowed to change the password if the file system is not writable.
    To remount the file system as writable, run the mount -o remount, rw / command.
  6. Run the passwd command and follow the instructions displayed on the command line to change the root password.
    Note that if the system is not writable, the passwd tool fails with the following error:
    Authentication token manipulation error
  7. To make sure that SELinux context of the files that were modified is restored properly after boot, run
    touch /.autorelabel
  8. Run the exec /sbin/init command to resume the initialization and finish the system boot.
    Running the exec command with another command specified replaces the shell and creates a new process; init in this case.
    Alternatively, if you wish to reboot the system, run the exec /sbin/reboot command instead.

Enjoy RHEL 7 :) Enjoy CentOS 7 :) Enjoy Linux :) Enjoy Open Source :)

Please Keep in Touch with Social Networking :- 

Facebook :- https://www.facebook.com/tejasbarot.official
Facebook Page :- https://www.facebook.com/AllLinuxUsersBlog
Twitter :- https://www.twitter.com/imtejasbarot
LinkedIn :- http://in.linkedin.com/in/imtejasbarot
Google+ :- https://plus.google.com/+TejasBarot

Content Protection by DMCA.com

RHEL 7 / CentOS 7: How to get started with Firewalld

Hello All,

Today I was trying to learn and know about Systemd. I have found one of the great Article about firewalld, Sharing with you guys, It will help you to understand this biggest and major change in RHEL and CentOS 7.

This article is not mine, I found on internet and felt that this is wonderful Article so Sharing with you all, Thanks to Original author, Given credit to him at the end of article.

firewalld

firewalld

Presentation

Firewalld is the new userland interface in RHEL 7. It replaces the iptables interface and connects to the netfilter kernel code. It mainly improves the security rules management by allowing configuration changes without stopping the current connections.

To know if Firewalld is running, type:

# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
   Active: active (running) since Tue 2014-06-17 11:14:49 CEST; 5 days ago
   ...

or alternatively:

# firewall-cmd --state
running

Note: If Firewalld is not running, the command displays not running.

If you’ve got several network interfaces in IPv4, you will have to activate ip_forwarding.
To do that, paste the following line in the /etc/sysctl.conf file:

net.ipv4.ip_forward=1

Then, activate the configuration:

# sysctl -p

Although Firewalld is the RHEL 7 way to deal with firewalls and provides many improvements, iptables can still be used.

Zone management

Also, a new concept of zone appears : all network interfaces can be located in the same default zone or divided into different ones according to the levels of trust defined.

To get the default zone, type:

# firewall-cmd --get-default-zone
public

To get the list of zones where you’ve got network interfaces assigned to, type:

# firewall-cmd --get-active-zones
public
interfaces: eth0

To get the list of all the available zones, type:

# firewall-cmd --get-zones
block dmz drop external home internal public trusted work

To get all the details about the public zone, type:

# firewall-cmd --zone=public --list-all
public (default, active)
  interfaces: eth0
  sources: 
  services: dhcpv6-client ssh
  ports: 
  masquerade: no
  forward-ports: 
  icmp-blocks: 
  rich rules: 

To change the default zone to home permanently, type:

# firewall-cmd --set-default-zone=home
success

Network interfaces can be assigned to a zone in a temporary (until the next reboot or reload) or permanent way.

To assign the eth0 network interface temporary to the internal zone, type:

# firewall-cmd --zone=internal --change-interface=eth0
success

To assign the eth0 network interface permanently to the internal zone (a file called internal.xml is created in the /etc/firewalld/zones directory), type:

# firewall-cmd --permanent --zone=internal --change-interface=eth0
success

To know which zone is associated with the eth0 interface, type:

# firewall-cmd --get-zone-of-interface=eth0
internal

Service management

After assigning each network interface to a zone, it is now possible to add services to each zone.
To allow the http service permanently in the internal zone, type:

# firewall-cmd --permanent --zone=internal --add-service=http
success
# firewall-cmd --reload

Note1: Type –remove-service=http to deny the http service.
Note2: The firewall-cmd –reload command is necessary to activate the change. Contrary to the –complete-reload option, current connections are not stopped.

To get the list of services in the default zone, type:

# firewall-cmd --list-services
dhcpv6-client ssh

Note: To get the list of the services in a particular zone, add the –zone= option.

Service firewall configuration

With the Firewalld package, the firewall configuration of the main services (ftp, httpd, etc) comes in the /usr/lib/firewalld/services directory. But it is still possible to add new ones in the /etc/firewalld/services directory. Also, if files exist at both locations for the same service, the file in the /etc/firewalld/services directory takes precedence.

For example, it is the case of the HAProxy service. There is no firewall configuration associated.
Create the /etc/firewalld/services/haproxy.xml and paste the following lines:

<?xml version="1.0" encoding="utf-8"?>
<service>
 <short>HAProxy</short>
 <description>HAProxy load-balancer</description>
 <port protocol="tcp" port="80"/>
</service>

Assign the correct SELinux context and file permissions to the haproxy.xml file:

# cd /etc/firewalld/services
# restorecon haproxy.xml
# chmod 640 haproxy.xml

Add the HAProxy service to the default zone permanently and reload the firewall configuration:

# firewall-cmd --permanent --add-service=haproxy
# firewall-cmd --reload

Port management

Port management follows the same model as service management.

To allow the 443/tcp port temporary in the internal zone, type:

# firewall-cmd --zone=internal --add-port=443/tcp
success
# firewall-cmd --reload

Note: type –remove-port=443/tcp to deny the port.

To get the list of ports open in the internal zone, type:

# firewall-cmd --zone=internal --list-ports
443/tcp

Masquerading

If your firewall is your network gateway and you don’t want everybody to know your internal addresses, you can set up two zones, one called internal, the other external, and configure masquerading on the external zone. This way, all packets will get your firewall ip address as source address.

To set up masquerading on the external zone, type:

# firewall-cmd --zone=external --add-masquerade

Note1: To remove masquerading, use the –remove-masquerade option.
Note2: To know if masquerading is active in a zone, use the –query-masquerade option.

Port forwarding

In addition to the masquerading, you can want to use port forwarding.
If you want all packets intended for port 22 to be now forwarded to port 3753, type:

# firewall-cmd --zone=external --add-forward-port=port=22:proto=tcp:toport=3753

Note1: To remove port forwarding, use the –remove-forward-port option.
Note2: To know if port forwarding is active in a zone, use the –query-forward-port option.
Also, if you want to define the destination ip address, type:

# firewall-cmd --zone=external --add-forward-port=port=22:proto=tcp:toport=3753:toaddr=10.0.0.1

Direct rules

It is still possible to set specific rules by using the direct mode (here to open the tcp port 9000) that by-passes the Firewalld interface:

# firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -p tcp --dport 9000 -j ACCEPT
success
# firewall-cmd --reload

Note: This last example has been borrowed from Khosro Taraghi’s blog.

To display all the direct rules added, type:

# firewall-cmd --direct --get-all-rules

In addition, you can read this very good article about Firewalld by Sander van Vugt.

Thanks to Original Author for explaining it very nicely.

Source : http://www.certdepot.net/rhel7-get-started-firewalld/

Enjoy Firewalld :) Enjoy Systemd :) Enjoy RHEL 7 :) Enjoy CentOS 7 :) Enjoy Open Source :)

Please Keep in Touch with Social Networking :- 

Facebook :- https://www.facebook.com/tejasbarot.official
Facebook Page :- https://www.facebook.com/AllLinuxUsersBlog
Twitter :- https://www.twitter.com/imtejasbarot
LinkedIn :- http://in.linkedin.com/in/imtejasbarot
Google+ :- https://plus.google.com/+TejasBarot

Content Protection by DMCA.com

RHEL 7 / CentOS 7 : Disable Firewalld and use iptables

Hello,

Just installed CentOS 7 on my Virtual machine and realized that, Firewalld is bit complicated as I am using iptables firewall from many years. So decided not to use firewalld at least as of now and wanted to continue with iptables commands as I was using in RHEL / CentOS 5 and 6.

I thought iptables will not be there and I will have to deal with firewalld but a little small trick in RHEL7 takes me to the solution which I wanted and I found that I can still use the iptables by disabling firewalld service.

So, If you are in same condition as mine and you want to use iptables on CentOS / RHEL 7 instead of firewalld, Please follow this howto.

Firewall

Firewall

As we all know that, CentOS / RHEL 7 both are completely systemd based, So We will have to use few systemd related commands to disable firewalld and enable iptables service.

1. Disable Firewalld Service.

[root@rhel-centos7-tejas-barot-linux ~]# systemctl mask firewalld

2. Stop Firewalld Service.

[root@rhel-centos7-tejas-barot-linux ~]# systemctl stop firewalld

3. Install iptables service related packages.

[root@rhel-centos7-tejas-barot-linux ~]# yum -y install iptables-services

4. Make sure service starts at boot:

[root@rhel-centos7-tejas-barot-linux ~]# systemctl enable iptables

# If you do not want ip6tables, You can skip following command.

[root@rhel-centos7-tejas-barot-linux ~]# systemctl enable ip6tables

5. Now, Finally Let’s start the iptables services.

[root@rhel-centos7-tejas-barot-linux ~]# systemctl start iptables

# If you do not want ip6tables, You can skip following command.

[root@rhel-centos7-tejas-barot-linux ~]# systemctl start ip6tables

Firewalld Service is now disabled and stop, You can use iptables.

Now, You will be able to use iptables as your firewall, You can add / remove rules as you were doing in previous releases of Red Hat / CentOS 5 and 6, You can configure firewall with iptables in same manner as previous.

Enjoy Linux :) Enjoy Firewall :) Enjoy iptables :) Enjoy ip6tables :) Enjoy FirewallD :) Enjoy CentOS 7 :) Enjoy RHEL 7 :) Enjoy Open Source

Please Keep in Touch with Social Networking :- 

Facebook :- https://www.facebook.com/tejasbarot.official
Facebook Page :- https://www.facebook.com/AllLinuxUsersBlog
Twitter :- https://www.twitter.com/imtejasbarot
LinkedIn :- http://in.linkedin.com/in/imtejasbarot
Google+ :- https://plus.google.com/+TejasBarot

Content Protection by DMCA.com

Information on Red Hat Certification / RHCE / RHEV / Red Hat OpenStack / RHEL 7

Hello Friends,

Certification

Certification

RHEL 7 is released, I am getting constant calls / emails / messages from many friends from different different places regarding their doubts on RHEL 5 to 6 or 6 to 7 up-gradation.

Sharing this to clear confusion / doubts.

Clear your doubts Regarding Up-gradation :-

1. Yes, RHEL 7 is out, but There is no compulsion or Mandatory from Red Hat to Upgrade your certificate from RHEL 5 to 6 or RHEL 6 to 7. Its not mandatory at all, It is all up to you.

2. Whether its RHEL 6 release or RHEL 7 release, If you are RHCE then Do not worry, Your Certificate is not going to expire. There is nothing like “expiry” in RHCE certificate, You will be still known as “Red Hat Certified Engineer” but the only difference is you will be known as “RHCE from non-current Version”.

3. RHCE Certificate / exam is not mandatory for Red Hat Enterprise Virtualization. You can give direct exam of RHEV.

4. Same in this case, RHCE Certificate / exam is not mandatory for RedHat OpenStack exam. You can give direct exam of Red Hat OpenStack.

I was getting lots of calls / emails / messages regarding these queries to help them out, I have shared this here so even if some friends from here are having same queries/doubts/confusion, So it will get cleared.

Correct me if I am wrong.

Hope this will helps you.

Please Keep in Touch with Social Networking :- 

Facebook :- https://www.facebook.com/tejasbarot.official
Facebook Page :- https://www.facebook.com/AllLinuxUsersBlog
Twitter :- https://www.twitter.com/imtejasbarot
LinkedIn :- http://in.linkedin.com/in/imtejasbarot
Google+ :- https://plus.google.com/+TejasBarot

Content Protection by DMCA.com

[Video] [HowTo] CentOS / RHEL 7 Installation with GUI / Custom Partition

Hello,

Today I have tried to Install CentOS 7 on my Virtual Machine. Sharing video of CentOS 7 Installation with GUI and Custom Partition with LVM.

Hope this video will help to those who wants to Install and Looking for easy guide for CentOS 7 Installation.

CentOS / RHEL 7 Installation Video

Enjoy CentOS 7 :) Enjoy RHEL 7 :) Enjoy Linux :) Enjoy Open Source :)

Please Keep in Touch with Social Networking :- 

Facebook :- https://www.facebook.com/tejasbarot.official
Facebook Page :- https://www.facebook.com/AllLinuxUsersBlog
Twitter :- https://www.twitter.com/imtejasbarot
LinkedIn :- http://in.linkedin.com/in/imtejasbarot
Google+ :- https://plus.google.com/+TejasBarot

Content Protection by DMCA.com

RHEL 7 / CentOS 7 : How to get started with Systemd

Hello All,

Today I was trying to learn and know about Systemd. I have found one of the great Article, Sharing with you guys, It will help you to understand this biggest and major change in RHEL and CentOS 7.

This article is not mine, I found on internet and felt that this is wonderful Article so Sharing with you all, Thanks to Original author, Given credit to him at the end of article.

 

RHEL / CentOS systemD

RHEL / CentOS systemD

Presentation

As the Systemd now replaces SysVinit, it is time to get familiar with it and learn new commands.
Systemd is quicker because it uses fewer scripts and tries to run more tasks in parallel (Systemd calls them units).
The Systemd configuration is stored in the /etc/systemd directory.

Boot process

Systemd primary task is to manage the boot process and provides informations about it.
To get the boot process duration, type:

# systemd-analyze
Startup finished in 422ms (kernel) + 2.722s (initrd) + 9.674s (userspace) = 12.820s

To get the time spent by each task during the boot process, type:

# systemd-analyze blame
7.029s network.service
2.241s plymouth-start.service
1.293s kdump.service
1.156s plymouth-quit-wait.service
1.048s firewalld.service
632ms postfix.service
621ms tuned.service
460ms iprupdate.service
446ms iprinit.service
344ms accounts-daemon.service
...
7ms systemd-update-utmp-runlevel.service
5ms systemd-random-seed.service
5ms sys-kernel-config.mount

Note: You will find additional information on this point in the Lennart Poettering’s blog.

Journal analysis

In addition, Systemd handles the system event log, a syslog daemon is not mandatory any more.
To get the content of the Systemd journal, type:

# journalctl

To get all the events related to the crond process in the journal, type:

# journalctl /sbin/crond

Note: You can replace /sbin/crond by `which crond`.

To get all the events since the last boot, type:

# journalctl -b

To get all the events that appeared today in the journal, type:

# journalctl --since=today

To get all the events with a syslog priority of err, type:

# journalctl -p err

To get the 10 last events and wait for any new one (like “tail -f /var/Log/messages”), type:

# journalctl -f

Note: You will find additional information on this point in the Lennart Poettering’s blog or Lennart Poettering’s video (44min: the first ten minutes are very interesting concerning security issues).

Control groups

Systemd organizes tasks in control groups. For example, all the processes started by an apache webserver will be in the same control group, CGI scripts included.

To get the full hierarchy of control groups, type:

# systemd-cgls
├─user.slice
│ └─user-1000.slice
│ └─session-1.scope
│ ├─2889 gdm-session-worker [pam/gdm-password]
│ ├─2899 /usr/bin/gnome-keyring-daemon --daemonize --login
│ ├─2901 gnome-session --session gnome-classic
. .
└─iprupdate.service
└─785 /sbin/iprupdate --daemon

To get the list of control group ordered by CPU, memory and disk I/O load, type:

# systemd-cgtop
Path Tasks %CPU Memory Input/s Output/s
/ 213 3.9 829.7M - -
/system.slice 1 - - - -
/system.slice/ModemManager.service 1 - - - -

To kill all the processes associated with an apache server (CGI scripts included), type:

# systemctl kill httpd

To put resource limits on a service (here 500 CPUShares), type:

# systemctl set-property httpd.service CPUShares=500

Note1: The change is written into the service unit file. Use the –runtime option to avoid this behavior.
Note2: By default, each service owns 1024 CPUShares. Nothing prevents you from giving a value smaller or bigger.

To get the current CPUShares service value, type:

# systemctl show -p CPUShares httpd.service

Sources: New control group interface, Systemd 205 announcement.

Service management

Systemd deals with all the aspects of the service management. The systemctl command replaces the chkconfig and the service commands. The old commands are now a link to the systemctl command.

To activate the NTP service at boot, type:

# systemctl enable ntpd

Note1: You should specify ntpd.service but by default the .service suffix will be added.
Note2: If you specify a path, the .mount suffix will be added.
Note3: If you mention a device, the .device suffix will be added.

To deactivate it, start it, stop it, restart it, reload it, type:

# systemctl disable ntpd
# systemctl start ntpd
# systemctl stop ntpd
# systemctl restart ntpd
# systemctl reload ntpd

To know if the NTP service is activated at boot, type:

# systemctl is-enabled ntpd
enabled

To know if the NTP service is running, type:

# systemctl is-active ntpd
inactive

To get the status of the NTP service, type:

# systemctl status ntpd
ntpd.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

If you change a service configuration, you will need to reload it:

# systemctl daemon-reload

To get the list of all the units (services, mount points, devices) with their status and description, type:

# systemctl

To get a more readable list, type:

# systemctl list-unit-files

To get the list of services that failed at boot, type:

# systemctl --failed

To get the status of a process (here httpd) on a remote server (here rhel7.example.com), type:

# systemctl -H root@rhel7.example.com status httpd.service

Run levels

Systemd also deals with run levels. As everything is represented by files in Systemd, target files replace run levels.

To move to single user mode, type:

# systemctl rescue

To move to the level 3 (equivalent to the previous level 3), type:

# systemctl isolate runlevel3.target

Or:

# systemctl isolate multi-user.target

To move to the graphical level (equivalent to the previous level 5), type:

# systemctl isolate graphical.target

To set the default run level to non-graphical mode, type:

# systemctl set-default multi-user.target

To set the default run level to graphical mode, type:

# systemctl set-default graphical.target

To get the current default run level, type:

# systemctl get-default
graphical.target

To stop a server, type:

# systemctl poweroff

Note: You can still use the poweroff command, a link to the systemctl command has been created (the same thing is true for the halt and reboot commands).

To reboot a server, suspend it or put it into hibernation, type:

# systemctl reboot
# systemctl suspend
# systemctl hibernate

Linux standardization

Systemd‘s authors have decided to help Linux standardization among distributions. Through Systemd, changes happen in the localization of some configuration files.

Miscellaneous

To get the server hostnames, type:

# hostnamectl
Static hostname: rhel7.example.com
Icon name: computer-laptop
Chassis: laptop
Machine ID: bcdc71f1943f4d859aa37e54a422938d
Boot ID: f84556924b4e4bbf9c4a82fef4ac26d0
Operating System: Red Hat Enterprise Linux Everything 7.0 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.0:beta:everything
Kernel: Linux 3.10.0-54.0.1.el7.x86_64
Architecture: x86_64

Note: There are three kinds of hostnames: static, pretty, and transient.
“The static host name is the traditional hostname, which can be chosen by the user, and is stored in the /etc/hostname file. The “transient” hostname is a dynamic host name maintained by the kernel. It is initialized to the static host name by default, whose value defaults to “localhost”. It can be changed by DHCP or mDNS at runtime. The pretty hostname is a free-form UTF8 host name for presentation to the user.” Source: RHEL 7 Networking Guide.

To assign the rhel7 hostname permanently to the server, type:

# hostnamectl set-hostname rhel7

Note: With this syntax all three hostnames (static, pretty, and transient) take the rhel7 value at the same time. However, it is possible to set the three hostnames separately by using the –pretty, –static, and –transient options.

To get the current locale, virtual console keymap and X11 layout, type:

# localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: en_US
X11 Layout: en_US

To assign the en_GB.utf8 value to the locale, type:

# localectl set-locale LANG=en_GB.utf8

To assign the en_GB value to the virtual console keymap, type:

# localectl set-keymap en_GB

To assign the en_GB value to the X11 layout, type:

# localectl set-x11-keymap en_GB

To get the current date and time, type:

# timedatectl
Local time: Fri 2014-01-24 22:34:05 CET
Universal time: Fri 2014-01-24 21:34:05 UTC
RTC time: Fri 2014-01-24 21:34:05
Timezone: Europe/Madrid (CET, +0100)
NTP enabled: yes
NTP synchronized: yes
RTC in local TZ: no
DST active: no
Last DST change: DST ended at
Sun 2013-10-27 02:59:59 CEST
Sun 2013-10-27 02:00:00 CET
Next DST change: DST begins (the clock jumps one hour forward) at
Sun 2014-03-30 01:59:59 CET
Sun 2014-03-30 03:00:00 CEST

To set the current date, type:

# timedatectl set-time YYYY-MM-DD

To set the current time, type:

# timedatectl set-time HH:MM:SS

To get the list of time zones, type:

# timedatectl list-timezones

To change the time zone to America/New_York, type:

# timedatectl set-timezone America/New_York

To get the users’ list, type:

# loginctl list-users
UID USER
42 gdm
1000 tom
0 root

To get the list of all current user sessions, type:

# loginctl list-sessions
SESSION UID USER SEAT
1 1000 tom seat0

1 sessions listed.

To get the properties of the user tom, type:

# loginctl show-user tom
UID=1000
GID=1000
Name=tom
Timestamp=Fri 2014-01-24 21:53:43 CET
TimestampMonotonic=160754102
RuntimePath=/run/user/1000
Slice=user-1000.slice
Display=1
State=active
Sessions=1
IdleHint=no
IdleSinceHint=0
IdleSinceHintMonotonic=0

For a better understanding, you can additionally read Bob Cromwell’s blog about Systemd.

Thanks to Original Author for explaining it very nicely.

Source : http://www.certdepot.net/rhel7-get-started-systemd/

Enjoy Systemd :) Enjoy RHEL 7 :) Enjoy CentOS 7 :) Enjoy

Please Keep in Touch with Social Networking :- 

Facebook :- https://www.facebook.com/tejasbarot.official
Facebook Page :- https://www.facebook.com/AllLinuxUsersBlog
Twitter :- https://www.twitter.com/imtejasbarot
LinkedIn :- http://in.linkedin.com/in/imtejasbarot
Google+ :- https://plus.google.com/+TejasBarot

Content Protection by DMCA.com