Wednesday, May 31, 2017

Force Users To Use Root Password Instead Of Their Own Password When Using Sudo Command

Force Users To Use Root Password Instead Of Their Own Password When Using Sudo Command


As we all know already, one of the advantages of using ‘sudo’ is we don’t have to give root user password to all users to do administrative actions. The users who are added in the sudo group can perform administrative tasks by simply invoking sudo command. Now, Picture this scenerio. Let us say, you’re the only one system admin who perform all administrative tasks, and your password is compromised by some hacker. Now, the hacker can do all sorts of administrative actions with sudo command, isn’t it? In such cases, we need to force some users (Admins& to use root password instead of their own password. This is just a simple example. The use cases might be different for you.

Disclaimer: Giving out the ROOT password to all users is dangerous. This method is opt for only one system admin who handles the entire systems in the network. Even If the system admin’s password is compromised, the hacker still needs to break the root password to do administrative tasks. So, the admin can immediately change his/her password or re-install the system before the hacker take down the system.
In this guide, We will see how to force users to use root password to do administrative tasks instead of using their own password when using sudo command.

Switch to root user using any one of the following commands:
su
Or,
sudo su
Or,
su root
Edit sudoers file using command:
visudo
Add/modify as shown below in sudoers file.
Defaults:sk rootpw
sk ALL = (ALL) ALL
This allows the user called sk to run any command using sudo privileges on any system. However, s/he needs to use the root password rather than his/her own password when using sudo command.
sudo ls -l
[sudo] password for root:
total 0
drwxr-xr-x. 2 sk sk 6 May 17 19:07 ostechnix
drwxr-xr-x. 2 root root 6 May 17 19:11 sk
As you see, it prompts you to enter the root password, not the user’s own password.
Even if your password is hacked, the hacker still need to crack the root user password to get the root access on your system. This will add little bit security to your system.

How To Exclude Specific Directories From Copying In Linux

How To Exclude Specific Directories From Copying In Linux

As you may already know, Rsync is a fast and versatile tool to copy files and folders locally, or to/from another host over any remote shell, or to/from a remote rsync daemon. Rsync has lot useful options. One of the useful option is –exclude. Using exclude option, we can exclude certain files/directories from copying. Let us see how to do it with an example.
Let us say you have a folder called ostechnix. Inside the directory ostechnix, there are three sub-directories namely dir1dir2, and dir3.
ls osnix/
Sample output:
dir1 dir2 dir3
You want to copy dir1 and dir3 to different location, but not dir2. How? Here is where rsync comes in help.
To exclude a specific directory from copying using rsync command, just run:
rsync -av --progress osnix/ backup/ --exclude dir2
Sample output would be:
sending incremental file list
./
dir1/
dir1/file1.pdf
 6,152,611 100% 58.36MB/s 0:00:00 (xfr#1, to-chk=7/11)
dir1/file2
 2,597,261 100% 14.83MB/s 0:00:00 (xfr#2, to-chk=6/11)
dir1/file3.doc
 88,143 100% 470.37kB/s 0:00:00 (xfr#3, to-chk=5/11)
dir1/file4.txt
 66,374 100% 330.71kB/s 0:00:00 (xfr#4, to-chk=4/11)
dir3/
dir3/file1.pdf
 6,152,611 100% 18.39MB/s 0:00:00 (xfr#5, to-chk=3/11)
dir3/file2
 2,597,261 100% 6.68MB/s 0:00:00 (xfr#6, to-chk=2/11)
dir3/file3.doc
 88,143 100% 224.16kB/s 0:00:00 (xfr#7, to-chk=1/11)
dir3/file4.txt
 66,374 100% 164.10kB/s 0:00:00 (xfr#8, to-chk=0/11)

sent 17,813,759 bytes received 187 bytes 11,875,964.00 bytes/sec
total size is 17,808,778 speedup is 1.00
The above command will copy all contents of the folder ostechnix to a folder namely backup, and it will exclude the directory dir2 from copying.
Alternatively, you can use the same command as below.
rsync -av --progress --exclude="folder_to_exclude" source_dirctory dest_directory
Example:
rsync -av --progress --exclude="dir2" ostechnix/ backup/
It is actually a good idea to omit or exclude some big or less important directories from copying while backup your system using rsync in order to save your time.

Tar command : Compress & Decompress the files\directories


One of the most performed functions during day to day activities of a system admin is data archiving or data compression/Decompression. And normally we use ‘tar’ command to do so but there are other options as well for data archiving or extraction, but that’ the tutorial for another time. In this tutorial, we are going to discuss ‘Tar’ command & the various actions we can achieve using it All these commands will work on most of the Linux distributions.

TAR Command

It is certainly the most popular & widely used command for compressing or decompressing files. It has integrated compression & create an archive with “.tar” extension & we can then also use compress it with ‘gzip’ or ‘bzip2’ compression method.
Let’s discuss some examples,

Creating a simple archive

To create a simple archive of using tar, syntax is
$ tar -cvf output.tar /path/input
here, -c will create an archive,
-v, will enable verbose mode & will show the progress,
-f, allows us to name the archive
output.tar, will be the name of the created archive, &
/path/input, is the complete path to file or directory that needs to be archived.

Creating a compressed GZIP archive

To create a compressed archive with tar, syntax will be
$ tar -cvzf output.tar.gz /path/input
here, -z option used with above mentioned command will help us create a Gzip compression based archive. Also notice the change in the output file extension, it will now be ‘.tar.gz’ or ‘tgz’instead of only ‘tar’.

Creating a compressed Bzip2 based archive

Now for some reason if we want to create an archive that used Bzip2 as the compression method, then we can use the following syntax to create a compressed archive
$ tar -cvjf output.tgz2 /path/input
Here, -j option will create a Bzip2 based tar archive & the resulting output file extension will be ‘tgz2’or ‘tar.bz2’

Compressing multiple directories

With tar we can also compress multiple directories at once, syntax for the command will be
$ tar -cvf output.tar /path/input1 /path/input2 /path/input3
Here, input1, input2, input3 are the various directories or files that needs to be compressed.

Creating an archive excluding some files/directories

We might need to create an archive or files or directories and might need to exclude some files from being archived. To do that, we can use ‘- – exclude’ option & syntax for the command will be,
$ tar -cvf output.tar /path/input1 — exclude=/path/exclude_file –exclude=/path/exclude_directory
We use multiple ‘–exclude’ to exclude multiple files & directories, we can also exclude a particular file type,
$ tar -cvf output.tar /path/input1 – exclude=/path/*.txt

Listing of files

We can also list the contents of an archive without extracting it using the following commands,
To view the contents of a simple tar archive, command is
$ tar -tvf output.tar
To view the content of a gzip tar archive, command is
$ tar -ztvf output.tar.gz
To view the content of Bzip2 archive, command is
$ tar -jtvf output.tar.gz2

Decompressing the archives

If we need to extract or decompress the archives, commands will be,
To extract the contents of a simple tar archive, command is
$ tar -xvf output.tar
To extract the content of a gzip tar archive, command is
$ tar -zxvf output.tar.gz
To extract the content of Bzip2 archive, command is
$ tar -jxvf output.tar.gz2

Tuesday, May 23, 2017

5 Ways To Repeat Your Last Command In Linux

5 Ways To Repeat Your Last Command In Linux

A note of caution: When you try the following methods, the previously executed commands will run immediately. Just make sure your last command wasn’t any harmful like formatting or deleting a drive, file or any important data.

Repeat Your Last Command In Linux

Let us run some commands first.
ls -l
pwd
date
uname -r

As you all might already know, we can execute the last command by simply pressing the up arrow and hit ENTER key. This is the most common way used by many users to execute the previous command. This method will work on all SHELL, regardless of the Linux operating system you use.
However, like I said already, there are few other methods to do this.
Now, let me show you how to execute the last command with some practical examples.

Method 1:
To execute any last executed command, just type double exclamation marks, and hit ENTER:
!!

This will execute the last command. Sample output would be:
uname -r
4.10.13-1-ARCH

Add “sudo” in-front of “!!” to execute the last command as root user like below.
sudo !!

Also, this command will execute the previous command:
su -c "!!"

Sample output:
su -c "uname -r"
Password: 
4.10.13-1-ARCH

Cool, isn’t it? You don’t need to type the last command completely. It could be useful  when you’ve already executed a very long command, and don’t want to re-type the same command fully.

Method 2:
You might have run so many commands, and want to repeat a specific command. What will you do? Simple! You can do this by typing a specific word of the previous command.

To repeat previous command that starts with a specific word/letter, for example un, just type:
!un

The above command will execute last command that starts with the letters “un”.
Sample output for the above command would be:
!un
uname -r
4.10.13-1-ARCH

As you see in the above example, you don’t need to type the whole command (i.e uname -r). Instead, just type few letters of a command, and any previous command that contains words will run.
Also, If you know the full command name, just type it like below:
!uname
It will execute the last command.

Method 3:
Another way to do this is by searching your command line history using CTRL+R. Press CTRL+R key to search through the command line history. I personally prefer this method. It searches history interactively which I think feels safer than executing blindly from it.
Look at the following example. In the following example, I searched for “un”, which displayed the last command “uname -r” in the history that contained the word “un”. Then, I hit ENTER to execute it.
 
(reverse-i-search)`un': uname -r

Just in case, you want to edit/modify the last command before executing it, just press the left arrow key, then edit the last command and hit ENTER to execute it.

Method 4:
Here is yet another way to run the previous command.
 
!-1

Sample output:
uname -r
4.10.13-1-ARCH
Similarly, !-2 will run the second last command, !-3 will run the third last command, and so on.

Method 5: 
I don’t want to type any command manually. Is there any way to repeat a last command by simply pressing a particular key(s) in my Keyboard? Yes, of course!

Press CTRL+P to switch to the last command, and then press CTRL+O to execute it. This will do the wonder. No configuration needed! You can use CTRL+O as many times as you want to keep re-executing the last commands.

And, that’s all. You know now how to repeat your last command without typing it in the Terminal. If you want to view the output of your last command without having to retype the last command, these methods will help.

 

Thursday, May 4, 2017

Top open source creative tools in 2016

Whether you want to manipulate images, edit audio, or animate stories, there's a free and open source tool to do the trick.


Open source tools have evolved a lot in the past few years, so let's take a tour of 2016 landscape.

Core applications

These six applications are the juggernauts of open source design tools. They are well-established, mature projects with full feature sets, stable releases, and active development communities. All six applications are cross-platform; each is available on Linux, OS X, and Windows, although in some cases the Linux versions are the most quickly updated. These applications are so widely known, I've also included highlights of the latest features available that you may have missed if you don't closely follow their development.
If you'd like to follow new developments more closely, and perhaps even help out by testing the latest development versions of the first four of these applications—GIMP, Inkscape, Scribus, and MyPaint—you can install them easily on Linux using Flatpak. Nightly builds of each of these applications are available via Flatpak by following the instructions for Nightly Graphics Apps. One thing to note: If you'd like to install brushes or other extensions to each Flatpak version of the app, the directory to drop the extensions in will be under the directory corresponding to the application inside the ~/.var/app directory.

GIMP

GIMP celebrated its 20th anniversary in 2015, making it one of the oldest open source creative applications out there. GIMP is a solid program for photo manipulation, basic graphic creation, and illustration. You can start using GIMP by trying simple tasks, such as cropping and resizing images, and over time work into a deep set of functionality. Available for Linux, Mac OS X, and Windows, GIMP is cross-platform and can open and export to a wide breadth of file formats, including those popularized by its proprietary analogue, Photoshop.
The GIMP team is currently working toward the 2.10 release; 2.8.18 is the latest stable version. More exciting is the unstable version, 2.9.4, with a revamped user interface featuring space-saving symbolic icons and dark themes, improved color management, more GEGL-based filters with split-preview, MyPaint brush support (shown in screenshot below), symmetrical drawing, and command-line batch processing. For more details, check out the full release notes.
GIMP screenshot

Inkscape

Inkscape is a richly featured vector-based graphic design workhorse. Use it to create simple graphics, diagrams, layouts, or icon art.
The latest stable version is 0.91; similarly to GIMP, more excitement can be found in a pre-release version, 0.92pre3, which was released November 2016. The premiere feature of the latest pre-release is the gradient mesh feature (demonstrated in screenshot below); new features introduce in the 0.91 release include power stroke for fully configurable calligraphic strokes (the "open" in "opensource.com" in the screenshot below uses powerstroke), the on-canvas measure tool, and the new symbols dialog (shown in the right side of the screenshot below). (Many symbol libraries for Inkscape are available on GitHub; Xaviju's inkscape-open-symbols set is fantastic.) A new feature available in development/nightly builds is the Objects dialog that catalogs all objects in a document and provides tools to manage them.
Inkscape screenshot

Scribus

Scribus is a powerful desktop publishing and page layout tool. Scribus enables you to create sophisticated and beautiful items, including newsletters, books, and magazines, as well as other print pieces. Scribus has color management tools that can handle and output CMYK and spot colors for files that are ready for reliable reproduction at print shops.
1.4.6 is the latest stable release of Scribus; the 1.5.x series of releases is the most exciting as they serve as a preview to the upcoming 1.6.0 release. Version 1.5.3 features a Krita file (*.KRA) file import tool; other developments in the 1.5.x series include the Table tool, text frame welding, footnotes, additional PDF formats for export, improved dictionary support, dockable palettes, a symbols tool, and expanded file format support.
Scribus screenshot

MyPaint

MyPaint is a drawing tablet-centric expressive drawing and illustration tool. It's lightweight and has a minimal interface with a rich set of keyboard shortcuts so that you can focus on your drawing without having to drop your pen.
MyPaint 1.2.0 is the latest stable release and includes new features, such as the intuitive inking tool for tracing over pencil drawings, new flood fill tool, layer groups, brush and color history panel, user interface revamp including a dark theme and small symbolic icons, and editable vector layers. To try out the latest developments in MyPaint, I recommend installing the nightly Flatpak build, although there have not been significant feature additions since the 1.2.0 release.
MyPaint screenshot

Blender

Initially released in January 1995, Blender, like GIMP, has been around for more than 20 years. Blender is a powerful open source 3D creation suite that includes tools for modeling, sculpting, rendering, realistic materials, rigging, animation, compositing, video editing, game creation, and simulation.
The latest stable Blender release is 2.78a. The 2.78 release was a large one and includes features such as the revamped Grease Pencil 2D animation tool; VR rendering support for spherical stereo images; and a new drawing tool for freehand curves.
Inkscape screenshot
To try out the latest exciting Blender developments, you have many options, including:
  • The Blender Foundation makes unstable daily builds available on the official Blender website.
  • If you're looking for builds that include particular in-development features, graphicall.org is a community-moderated site that provides special versions of Blender (and occasionally other open source creative apps) to enable artists to try out the latest available code and experiments.
  • Mathieu Bridon has made development versions of Blender available via Flatpak. See his blog post for details: Blender nightly in Flatpak.

Krita

Krita is a digital drawing application with a deep set of capabilities. The application is geared toward illustrators, concept artists, and comic artists and is fully loaded with extras, such as brushes, palettes, patterns, and templates.
The latest stable version is Krita 3.0.1, released in September 2016. Features new to the 3.0.x series include 2D frame-by-frame animation; improved layer management and functionality; expanded and more usable shortcuts; improvements to grids, guides, and snapping; and soft-proofing.
Krita screenshot

Video tools

There are many, many options for open source video editing tools. Of the members of the pack, Flowblade is a newcomer and Kdenlive is the established, newbie-friendly, and most fully featured contender. The main criteria that may help you eliminate some of this array of options is supported platforms—some of these only support Linux. These all have active upstreams and the latest stable versions of each have been released recently, within weeks of each other.

Kdenlive

Kdenlive, which was initially released back in 2002, is a powerful non-linear video editor available for Linux and OS X (although the OS X version is out-of-date). Kdenlive has a user-friendly drag-and-drop-based user interface that accommodates beginners, and with the depth experts need.
Learn how to use Kdenlive with an multi-part Kdenlive tutorial series by Seth Kenlon.
  • Latest Stable: 16.08.2 (October 2016)

Flowblade

Released in 2012, Flowblade, a Linux-only video editor, is a relative newcomer.
  • Latest Stable: 1.8 (September 2016)

Pitivi

Pitivi is a user-friendly free and open source video editor. Pitivi is written in Python (the "Pi" in Pitivi), uses the GStreamer multimedia framework, and has an active community.

Shotcut

Shotcut is a free, open source, cross-platform video editor that started back in 2004 and was later rewritten by current lead developer Dan Dennedy.
  • Latest stable: 16.11 (November 2016)
  • 4K resolution support
  • Ships as a tarballed binary

OpenShot Video Editor

Started in 2008, OpenShot Video Editor is a free, open source, easy-to-use, cross-platform video editor.
  • Latest stable: 2.1 (August 2016)

Utilities

SwatchBooker

SwatchBooker is a handy utility, and although it hasn't been updated in a few years, it's still useful. SwatchBooker helps users legally obtain color swatches from various manufacturers in a format that you can use with other free and open source tools, including Scribus.

GNOME Color Manager

GNOME Color Manager is the built-in color management system for the GNOME desktop environment, the default desktop for a bunch of Linux distros. The tool allows you to create profiles for your display devices using a colorimeter, and also allows you to load/managed ICC color profiles for those devices.

GNOME Wacom Control

The GNOME Wacom controls allow you to configure your Wacom tablet in the GNOME desktop environment; you can modify various options for interacting with the tablet, including customizing the sensitivity of the tablet and which monitors the tablet maps to.

Xournal

Xournal is a humble but solid app that allows you to hand write/doodle notes using a tablet. Xournal is a useful tool for signing or otherwise annotating PDF documents.

PDF Mod

PDF Mod is a handy utility for editing PDFs. PDF Mod lets users remove pages, add pages, bind multiple single PDFs together into a single PDF, reorder the pages, and rotate the pages.

SparkleShare

SparkleShare is a git-backed file-sharing tool artists use to collaborate and share assets. Hook it up to a GitLab repo and you've got a nice open source infrastructure for asset management. The SparkleShare front end nullifies the inscrutability of git by providing a dropbox-like interface on top of it.

Photography

Darktable

Darktable is an application that allows you to develop digital RAW files and has a rich set of tools for the workflow management and non-destructive editing of photographic images. Darktable includes support for an extensive range of popular cameras and lenses.
Changing color balance screenshot

Entangle

Entangle allows you to tether your digital camera to your computer and enables you to control your camera completely from the computer.

Hugin

Hugin is a tool that allows you to stitch together photos in order to create panoramic photos.

2D animation

Synfig Studio

Synfig Studio is a vector-based 2D animation suite that also supports bitmap artwork and is tablet-friendly.

Blender Grease Pencil

I covered Blender above, but particularly notable from a recent release is a refactored grease pencil feature, which adds the ability to create 2D animations.

Krita

Krita also now provides 2D animation functionality.

Music and audio editing

Audacity

Audacity is popular, user-friendly tool for editing audio files and recording sound.

Ardour

Ardour is a digital audio workstation with an interface centered around a record, edit, and mix workflow. It's a little more complicated than Audacity to use but allows for automation and is generally more sophisticated. (Available for Linux, Mac OS X, and Windows.)

Hydrogen

Hydrogen is an open source drum machine with an intuitive interface. It provides the ability to create and arrange various patterns using synthesized instruments.

Mixxx

Mixxx is a four-deck DJ suite that allows you to DJ and mix songs together with powerful controls, including beat looping, time stretching, and pitch bending, as well as live broadcast your mixes and interface with DJ hardware controllers.

Rosegarden

Rosegarden is a music composition suite that includes tools for score writing and music composition/editing and provides an audio and MIDI sequencer.

MuseScore

MuseScore is a music score creation, notation, and editing tool with a community of musical score contributors.

Additional creative tools

MakeHuman

MakeHuman is a 3D graphical tool for creating photorealistic models of humanoid forms.

Natron

Natron is a node-based compositor tool used for video post-production and motion graphic and special effect design.

FontForge

FontForge is a typeface creation and editing tool. It allows you to edit letter forms in a typeface as well as generate fonts for using those typeface designs.

Valentina

Valentina is an application for drafting sewing patterns.

Calligra Flow

Calligra Flow is a Visio-like diagramming tool. (Available for Linux, Mac OS X, and Windows.)

Resources

There are a lot of toys and goodies to try out there. Need some inspiration to start your exploration? These websites and conference are chock-full of tutorials and beautiful creative works to inspire you get you going:
  1. pixls.us: Blog hosted by photographer Pat David that focuses on free and open source tools and workflow for professional photographers.
  2. David Revoy's Blog The blog of David Revoy, an immensely talented free and open source illustrator, concept artist, and advocate, with credits on several of the Blender Foundation films.
  3. The Open Source Creative Podcast: Hosted by Opensource.com community moderator and columnist Jason van Gumster, who is a Blender and GIMP expert, and author of Blender for Dummies, this podcast is directed squarely at those of us who enjoy open source creative tools and the culture around them.
  4. Libre Graphics Meeting: Annual conference for free and open source creative software developers and the creatives who use the software. This is the place to find out about what cool features are coming down the pipeline in your favorite open source creative tools, and to enjoy what their users are creating with them.