Tuesday, July 28, 2015

How to record Terminal session?

If you want to record your terminal session for your personal notes or for tutorial purpose you have an in built tool. In Linux's all flavours you get "script" command which record your all work of your terminal.

- How to use
a) open your terminal
b) run "script" command as given below
# script /tmp/record.txt
=> Now your recording has started and session is going to be saved in /tmp/record.txt
d) When you are done stop the recording by ctrl+d
e) cat /tmp/record.txt

This method is used to monitor root activities in my workplace. It copies all the text in standard output to the file you mention in script command.

Friday, July 24, 2015

How to connect Windows Phone 8.1 to Fedora 22?

I need to connect Windows Phone 8.1 to Fedora 22 GNOME for managing files using USB cable. When I connect my phone to laptop running Fedora 22 I don't see my mobile device.

Solution:
To detect your phone in GNOME Fedora 22, you need to install following package. You can install by issuing below command.

sudo dnf install gvfs-mtp

Command explanation:
sudo - To install package using normal user. If you are not logged in to root user you need to use sudo command.
dnf - It is the new package installer in Fedora 22. Previously it was YUM. Even YUM installer works now. DNF is the latest with more added feature.
gvfs-mtp - This package is used to recognize mobile file system.

Wednesday, July 22, 2015

Fedora 22 not working after Windows 10 installation

I have Fedora 22 and by now windows 10 and well. Now Fedora isn't work because Windows split the grub2 and I've tried everything to get it back, but now all I have is this display :

How to reinstall grub2 and make it work with both OS.?

Solution:

Recovery boot from DVD media. chroot to /mnt/sysimage, grub2-install

Tuesday, July 21, 2015

Why RHEL 7 charges you even though it is open source?

Many recommends CentOS 7 because it is open source and provide same features as red hat 7 and you can not use the red hat product without license. So what does open source mean? Is Cent OS same as Redhat?

I keep seeing people say sorta the same you do here. Let's get a few things straight - if Red Hat Enterprise Linux (RHEL) wasn't open source, CentOS would not exist - it would be illegal to recompile from the RHEL source code. OEL and Scientific Linux wouldn't exist, and there's a good chance Fedora wouldn't either or at least not in the form it exists today. That's just the beginning. You seem to confuse open source with free - that's not the case. "Free as in Beer" is what CentOS is. "Free as in Liberty" is what RHEL is. Where CentOS is Gratis - RHEL is commercially supported.

That leads to your comment about license. CentOS has a license too - the exact SAME license as RHEL. GPLv3 governs both of them. The license defines things like ownership. You do not own CentOS - the developers do. It's even copy-righted! You cannot just make a copy of CentOS and remove the copy-right notes and proclaim it's your code. That would be breaking the LICENSE that gives you the right to copy and modify the code as much as you want. All Open Source is governed by Licenses - you should read up on your history and what Richard Stallman did to create the open source movement. So Red Hat does not sell licenses. Oracle does - IBM does - Microsoft does - but not Red Hat. Red Hat is 100% open source, and has probably open sourced more proprietary code than any other commercial entity has out there. oVirt (KVM), SELinux, ManageIQ to just mention a few of the many initially were closed sourced projects. Projects that anyone can download, compile and use - they even exist ready to install from EPEL.
Red Hat sells subscriptions. Like subscribing to a magazine. If you have subscriptions you get access to services that are important to enterprises - such as timely updates, support, expert knowledge bases just to begin the long list of things. Once your subscription expires, you can keep everything you have - try that with Oracle or IBM!

As to RHEL and CentOS being the same, it depends on what you mean by "the same". Binary they are far from the same. Patches and distribution is not the same and CentOs doesn't certify or guarantee that anything will work (Red Hat does for RHEL).

CentOS is a great distribution - done by a very few people that everyone get mad at when they dare to have a private life outside CentOS. It provides a great platform to learn from and experiment on and it follows the same structure that RHEL does so things look very similar to RHEL. If you want to learn how to create an FTP server, Web Server etc. then CentOS is a great platform to do that on.

However, if you're trying to build a business and you need the FTP server to make your money, CentOS is a bad platform to bet on. If things go bad, you really have nowhere to go - you have to be the expert in everything - and face it, nobody is an expert in everything. That's what RHEL gives you - a professional backing for doing things right the first time, and if things go bad you have a group of very smart professionals to help you out. So instead of losing your business you can be successful and make a lot of money.

Tuesday, July 14, 2015

Does it requires internet connection while installing Fedora, rpm and yum?

No.

If you only mean installation and nothing else, which isn't really a "yum" event for normal users, then you just need to plug in DVD and boot. That installs Fedora based on what's on the DVD. However, most people want to keep their installation up to date; they want to get access to the tens of thousands of software packages available which aren't on the install DVD to begin with. And regardless of how you bend and twist things, you'll need to download updates and new software packages from SOMEWHERE. With Linux and Fedora in particular, this function is EASY as Pie as they say - yum does it all in one command.

Or put in another way - you got the installation DVD from somewhere - the data on that DVD came from somewhere. Someone downloaded the ISO and burned it to a DVD to begin with. So you're still depending on data from "the internet".

Tuesday, July 7, 2015

How to restrict file types using sftp/vsftp?

Is it possible to restrict file types using sftp/vsftp in Linux?
I want client can only upload csv, log, xls,txt type files.


Depending on the use case, there are plenty of ways to address getting rid of unwanted files. The "cheap" way is to have a cron job run every 5 minutes that removes unwanted files. Or we can run a cleanup after a session ends. Or use inotify and run jobs as a file is created etc. Combined with FS quotas you can block a user from uploading very large files etc.

But remember - file system extensions means nothing in Linux. And well, the same goes for Windows actually. I can take my shell script and name it "myscript.txt" and your check would succeed.

So I would probably look at other options if you're trying to make sure you only process valid files.