How to use sudo on RHEL, CentOS, AlmaLinux, Rocky Linux or Oracle Linux

Red hat on a mysterious woman (generated by Midjourney). Credit: libre-software.net. License: CC BY-SA 4.0

How to use sudo on RHEL, CentOS, AlmaLinux, Rocky Linux or Oracle Linux

Last updated on October 6, 2022

This short howto is about setting up sudo on Red Hat Entreprise Linux (RHEL) and its derivates – for example CentOS, AlmaLinux, Rocky Linux or Oracle Linux. It also gives a quick introduction on using the vi text editor through visudo.

Becoming root: su & sudo

CentOS, Scientific Linux and RHEL do not use sudo as Ubuntu does. Instead, you are supposed to use su or su root to get higher permissions. su stands for super user or switch user. Type exit to exit the superuser mode. More information on su on the CentOS Wiki.

After years using Ubuntu and Linux Mint, I got used to sudo. To be able to run sudo on CentOS, one has to add the current user to the /etc/sudoers file. Editing the sudoers file is done via the visudo utility.

Editing sudoers with visudo

Visudo edits the sudoers file in a safe fashion, locks the sudoers file against multiple simultaneous edits, provides basic sanity checks, and checks for parse errors. (from the visudo man page)

You can only run visudo as root, so that we’ll need to run su:
su root

The next step is to run visudo without any parameters. It will open the /etc/sudoers file in vi (a text editor):
visudo

Using the vi text editor

There is no need to be familiar with vi, just to know the some basics. Vi has two so called “modes”:
– The insert mode allows you to insert/write text
– The command mode is for saving files, text manipulation and much more.

To edit a file, type i to enter the insert mode.
Press Esc to exit the insert mode and enter the command mode.

In command mode, use a : colon to start commands:

Press : + w + q + Enter to save your changes and exit (write and quit)

Type : + q + ! + Enter to exit without saving changes.

Add yourself to the sudoers in visudo

All you have to do now is to add the following line at the end of the file (press i to enter insert mode):
user_name ALL=(ALL) ALL

ALL must be written in capital letters. Replace user_name with your user name.

Visudo - Adding user to sudoers in CentOS, Scientific Linux and RHEL

Finally, press Esc to enter the command mode, and : + w + q + Enter to save and exit the editor. Changes are effective immediately, you may now use sudo.

N.B. If you plan to use Truecrypt, comment out the following line in /etc/sudoers by inserting a dash:
#Default requiretty

By Johannes Eva, 2012 – October 2022

Articles by categories

Most Read Articles

Comments

5 thoughts on “How to edit image metadata on Linux using a graphical user interface”

  1. fotoxx lets you change Metadata info, and choose your current image’s Caption and Comment as well as view images in directories with filename and some other Metadata as labels. You can set up trees of tags with Categories and put those in at the same time, to use for sorting the images into “album” groups for moving or copying out. The code is gtk and perl with many filetype handlers. Your labeling is stored in plain text files, easy to copy out into documents, transfer, edit, etc.

  2. You should give some additional details, some tools write directly into the image file, others don’t. For example darktable does not change the original image, it writes into a sidecar file (.XMP).

  3. I don’t know whether you actually tested Gthumb or not, but your statement that it is only capable of reading meta tags, couldn’t be further from the truth. And it seems to do a fairly good while it is at it!

    All one have do is to press the ‘T’ key – either under the Thumbnail view or the “larger” view – and voilá: it reads any existing tags already embedded in the selected file. Next, you have to keep typing any new ones (just don’t forget to confirm, via the pull down list, to actually create any new tags) and you’re done.

  4. I would also suggest that MaPiVi is an excellent program which needs to be on this list. It’s capable of editing and bulk-editing many kinds of image metadata, including IPTC Keywords (which is why I got it). It’s written in Perl/TK so it’s cross-platform. A somewhat old version of it is included in the Ubuntu Linux distribution.

    One of the main drawbacks of MaPiVi is that it won’t handle the metadata in Nikon .NEF (raw) format files, which is pretty much the same as that in other formats such as JPEG.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.