Modules are code pieces that dynamically can be loaded into memory. Parameters are data passed to code inside the kernel (or modules).
Some parameters aren't related to modules. Go to kernel.org and look at how the kernel is organized. There's a tons of parameters in /proc and /sys to tune anything from networking to disk caching.
Parameters on the kernel line (that you see in /proc/cmdline) are mostly to manage the boot process, getting initial system stuff done, which could be in modules. And remember, modules can be compiled directly into the kernel too - they don't have to be dynamic.
Tuesday, December 1, 2015
Monday, November 30, 2015
How to get trained for RHCE 7 - any best practices suggestions to pass for 100%?
Official training is good, but you need experience more than training. You should already be using Linux and if you're using RHEL or a clone, you're starting out good - but even Ubuntu or Debian would be very helpful training your skills. So don't be choosy. Setup a file server and/or webserver that you use on your local lan, start using it and as you do, you'll have challenges you have to solve. Work down the list of exam objectives and using online guides or books to help you with the areas you have to train it, start using Linux and better RHEL. After a few months of using it every day, you can then do the training and if you find that you have trouble, practice more on your own.
Join community groups - local LUGs, mailing lists, go to IRC and hang out in the forums and channels around the distribution you're using. PARTICIPATE - don't just ask questions (but do ask) - answer too. Help out. Maybe you can help translating or writing documentation. Or you can file bugs and issues to get things fixed that aren't working. Build a network of people within the Open Source community who'll get to know you and your skills. It will come in handy when you start looking for a job and you'll also be able to help others out who are trying to learn.
Join community groups - local LUGs, mailing lists, go to IRC and hang out in the forums and channels around the distribution you're using. PARTICIPATE - don't just ask questions (but do ask) - answer too. Help out. Maybe you can help translating or writing documentation. Or you can file bugs and issues to get things fixed that aren't working. Build a network of people within the Open Source community who'll get to know you and your skills. It will come in handy when you start looking for a job and you'll also be able to help others out who are trying to learn.
I have deleted my windows partition by mistakly so i want to recover my partition or my data
Backups my friend. That's why we have them. There's no way working with computers every day, that you won't screw up now and then, even if you're careful.
If you know _exactly_ what you did, and what was lost, it means you can restore just those parts. Ie. if it's just the partition table that got wiped, you can just restore that and be fine. If you also wiped file system details, boot information etc. you'll have to restore those bits too.
If you do not know what you lost, you either have to do some digging and fine out using IT forrentics principles or do a full restore.
Unless you know the cylinder information for the old partition, you'll have to guess or use recovery tools to help you do forentic analysis on the disk to see if you can find what the values should be. That assumes no data was wiped out by Window's Disk Manager - which it may very well have been. Hopefully somebody on here would know.
It can be easy - if you have the information required to know what was lost, and know what to set it to. Nobody here can tell you since we don't know your system before you deleted things - and exactly what was deleted. There are plenty of tools out there to help you diagnose and search for lost partitions, but that will not help you if more than just the partition entry was deleted. Since we don't know what you did, it's impossible to tell you what to do.
If you know _exactly_ what you did, and what was lost, it means you can restore just those parts. Ie. if it's just the partition table that got wiped, you can just restore that and be fine. If you also wiped file system details, boot information etc. you'll have to restore those bits too.
If you do not know what you lost, you either have to do some digging and fine out using IT forrentics principles or do a full restore.
Unless you know the cylinder information for the old partition, you'll have to guess or use recovery tools to help you do forentic analysis on the disk to see if you can find what the values should be. That assumes no data was wiped out by Window's Disk Manager - which it may very well have been. Hopefully somebody on here would know.
It can be easy - if you have the information required to know what was lost, and know what to set it to. Nobody here can tell you since we don't know your system before you deleted things - and exactly what was deleted. There are plenty of tools out there to help you diagnose and search for lost partitions, but that will not help you if more than just the partition entry was deleted. Since we don't know what you did, it's impossible to tell you what to do.
Sunday, November 29, 2015
How to disable USB storage device and external Hard Disk Fedora?
Issue:
How to disable USB storage device and external Hard Disk ( Note:- Don't want to disable USB keyboard and mouse ) in Red hat 7 and CentOS 7.
Solution:
You have to edit and write a few udev policy rules.
You cannot "disable" it (easily) - remove the plugs from the mother board, inactivate them in the bios is as close as you get to disabling things completely. In the end, the way to prevent it's use is to not install software to use a feature, and not provide physical access to a system. Once it's known by the BIOS it's known to the system. You can completely remove USB support from the kernel, but you can still work around that in theory.
So remove FUSE, use udev to set security so the devices cannot be accessed by end users (note that anyone can create device file and use that - so you need other system security like selinux to block for those options). http://weininger.net/how-to-write-udev-rules-for-usb-devices.html is an example of how to do udev. UDev is quite complex and has many many rules that you'll need to visit.
Saturday, November 28, 2015
Which course is best for future life? CCNA or Windows Server or Redhat linux
Deciding career between CCNA or Windows Server or Redhat linux:
You're going to get 100 answers to that question, nobody can really tell the future. We don't know your background, we don't know the area you live in, your ability to relocate if need be etc. All of which impacts an answer that is useful for you. While data centers are now Linux and Windows primarily, that may not be what you end up working with. You may do Windows support more than anything, or maybe you end up as a storage admin which is skills you don't even list.
The internet runs on Linux - no doubt about it. But are those companies hiring where you live? Or are the companies where you live still mainly using Windows? In the next 4-5 years are you expecting to move to another area? If not, it's the area you live in mainly need Windows skills that is what you need to focus on. If they do Linux then focus on that. If they do both, do both! Common for all IT is networking, so that's not a bad skill to have.
So there's no way you are going to just be able to pick ONE of those. With time you should aim at getting all of them, and then some. Right now, your focus should be on what gets you hired or paid better at companies in your neighborhood You can find that using websites like Payscale, Glassdoor etc.
You're going to get 100 answers to that question, nobody can really tell the future. We don't know your background, we don't know the area you live in, your ability to relocate if need be etc. All of which impacts an answer that is useful for you. While data centers are now Linux and Windows primarily, that may not be what you end up working with. You may do Windows support more than anything, or maybe you end up as a storage admin which is skills you don't even list.
The internet runs on Linux - no doubt about it. But are those companies hiring where you live? Or are the companies where you live still mainly using Windows? In the next 4-5 years are you expecting to move to another area? If not, it's the area you live in mainly need Windows skills that is what you need to focus on. If they do Linux then focus on that. If they do both, do both! Common for all IT is networking, so that's not a bad skill to have.
So there's no way you are going to just be able to pick ONE of those. With time you should aim at getting all of them, and then some. Right now, your focus should be on what gets you hired or paid better at companies in your neighborhood You can find that using websites like Payscale, Glassdoor etc.
Friday, November 27, 2015
All the ports are open in Linux by default?
Recently I got a question in my mail from Seth - All the ports are open in Linux by default?
Linux is a kernel - no more, no less. A ton of software is needed in addition to the kernel, and you have a lot of options in regards to what software, and what it needs to do. That's why we have hundreds of distributions and even more if you include embedded devices that all are "Linux" but very very different. So when you ask what "Linux" does, it makes NO SENSE what so ever. You have to be specific here otherwise you're not going to get much of an answer - or rather something that is useful to you.
Presuming you're talking about RHEL or at least CentOS here - and that's a very big if - the firewall is enabled by default yes and will block all but port 22 incoming traffic.
Even some ports like 80 willnot be open on RHEL/CentOS after a default install. The only way you can get http and other services to work without opening the ports in the firewall, is by disabling the firewall (or not installing it).
Btw - note that different installation options results in different configurations. Every installation you do, you should NEVER assume a default setup - always explicitly set the features you depend on.
Linux is a kernel - no more, no less. A ton of software is needed in addition to the kernel, and you have a lot of options in regards to what software, and what it needs to do. That's why we have hundreds of distributions and even more if you include embedded devices that all are "Linux" but very very different. So when you ask what "Linux" does, it makes NO SENSE what so ever. You have to be specific here otherwise you're not going to get much of an answer - or rather something that is useful to you.
Presuming you're talking about RHEL or at least CentOS here - and that's a very big if - the firewall is enabled by default yes and will block all but port 22 incoming traffic.
Even some ports like 80 willnot be open on RHEL/CentOS after a default install. The only way you can get http and other services to work without opening the ports in the firewall, is by disabling the firewall (or not installing it).
Btw - note that different installation options results in different configurations. Every installation you do, you should NEVER assume a default setup - always explicitly set the features you depend on.
Tuesday, August 25, 2015
OpenLdap permission denied issue
While starting the ldap service you will get following error:
ldif_read_file: Permission denied for "/etc/ldap/slapd.d/cn=config.ldif"
slapadd: bad configuration file!
Solution:
Change permission to ldap. The command is
chown ldap. /etc/openldap/slapd.d
Tuesday, August 18, 2015
Command to find out top 10 most CPU-occupying processes
I hope you know how to interpret average CPU load figures first. I have seen lot of people thinking that if average load is more than 1.0 then it's too much load.
To figure out top 10 most CPU-occupying processes:
ps aux | sort -r -nk6 | head -10
To figure out top 10 most CPU-occupying processes:
ps aux | sort -r -nk6 | head -10
Tuesday, August 11, 2015
Why can't I update RHEL for free?
Red Hat Enterprise Linux is primarily used for commercial support type systems. When you purchase a Red Hat subscription, not only do you get access to support, updates but also an extensive knowledge base and other help to ensure your systems are correctly and optimal configured. You have people to talk to if you have questions or problems, and if things go really bad you'll even get people on site to help you.
As you probably also know, there are tons of training and other help available with Red Hat Enterprise Linux too which are separate purchases.
The question you'll need to ask yourself is why you're looking for RHEL - if you are doing so because you're going to setup servers for work and mission critical systems, please reach out to Red Hat sales and they'll help you pick and chose the right options. But if you're doing so for learning and home use only, the benefits of using a Red Hat Enterprise Linux version may not be worth the price. If you're a developer creating content that needs to run on RHEL, you can actually get RHEL very cheap or even free if certain conditions are met.
As others have said, you can download RHEL from http://access.redhat.com. Downloading the ISO is only the first step; registering and setting things up on access.redhat.com to support your systems is very important too. And eval version gives you access to everything at Red Hat in a short period of time. But unlike other vendors, once the eval expires the software does not stop working, nor is it illegal to use it. You just lose the ability to update and access to knowledgebase, support etc. - but your system keeps running. Look at this like you would a magazine subscription - once the subscription expires, you can still keep and read the old issues. You just don't get any new ones. That's how RHEL works.
For practice and learning there are lots of great resources on access.redhat.com too - ie. how to configure DNS servers, DHCP, clustering etc. - created specifically for the version of RHEL that you're using, validated and verified. That includes forums to ask questions and help others.
CentOS has similar resources but they aren't guaranteed to work. It's entirely maintained by community members, who may use different versions and setups than you are etc. - but then again, that may provide the challenge for you to actually learn how things work instead of just following instructions. There are good guides out there for CentOS and bad ones. But it's free and if all you are looking for is something to learn from, it's a pretty good platform.
As you probably also know, there are tons of training and other help available with Red Hat Enterprise Linux too which are separate purchases.
The question you'll need to ask yourself is why you're looking for RHEL - if you are doing so because you're going to setup servers for work and mission critical systems, please reach out to Red Hat sales and they'll help you pick and chose the right options. But if you're doing so for learning and home use only, the benefits of using a Red Hat Enterprise Linux version may not be worth the price. If you're a developer creating content that needs to run on RHEL, you can actually get RHEL very cheap or even free if certain conditions are met.
As others have said, you can download RHEL from http://access.redhat.com. Downloading the ISO is only the first step; registering and setting things up on access.redhat.com to support your systems is very important too. And eval version gives you access to everything at Red Hat in a short period of time. But unlike other vendors, once the eval expires the software does not stop working, nor is it illegal to use it. You just lose the ability to update and access to knowledgebase, support etc. - but your system keeps running. Look at this like you would a magazine subscription - once the subscription expires, you can still keep and read the old issues. You just don't get any new ones. That's how RHEL works.
For practice and learning there are lots of great resources on access.redhat.com too - ie. how to configure DNS servers, DHCP, clustering etc. - created specifically for the version of RHEL that you're using, validated and verified. That includes forums to ask questions and help others.
CentOS has similar resources but they aren't guaranteed to work. It's entirely maintained by community members, who may use different versions and setups than you are etc. - but then again, that may provide the challenge for you to actually learn how things work instead of just following instructions. There are good guides out there for CentOS and bad ones. But it's free and if all you are looking for is something to learn from, it's a pretty good platform.
Tuesday, August 4, 2015
How to set SSH login limits?
You can limit the maximum number of simultaneous SSH logins by updating the file "/etc/security/limits.conf" with "* maxsyslogins <no.>"
The no. should be a integer.
Below is the description about limits.conf file
[guest@localhost yum.repos.d]$ more /etc/security/limits.conf
# /etc/security/limits.conf
#
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.
#
#Also note that configuration files in /etc/security/limits.d directory,
#which are read in alphabetical order, override the settings in this
#file in case the domain is the same or more specific.
#That means for example that setting a limit for wildcard domain here
#can be overriden with a wildcard setting in a config file in the
#subdirectory, but a user specific setting here can be overriden only
#with a user specific setting in the subdirectory.
The no. should be a integer.
Below is the description about limits.conf file
[guest@localhost yum.repos.d]$ more /etc/security/limits.conf
# /etc/security/limits.conf
#
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.
#
#Also note that configuration files in /etc/security/limits.d directory,
#which are read in alphabetical order, override the settings in this
#file in case the domain is the same or more specific.
#That means for example that setting a limit for wildcard domain here
#can be overriden with a wildcard setting in a config file in the
#subdirectory, but a user specific setting here can be overriden only
#with a user specific setting in the subdirectory.
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.
- 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.
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.?
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.
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".
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.
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.
Tuesday, June 30, 2015
FTP or SFTP without password in Linux
I want to make shell script to download the file automatically from the linux server. so i want to know, how to pass the username and password parameters in sftp command inside the shell script ?
ssh-keygen
<no passphrase>
ssh-copy-id your_login@remote.host
Now you can log in without password and use simple command in your script: sftp your_login@remote.host
2. If you use ftp:
touch ~/.netrc
echo "machine <remote_host> login <your_login> password <your_password>" > ~/.netrc
chmod 600 ~/.netrc
Now you can login in without password - ftp remote.host
FTP/SFTP without password
1. If you use sftp:ssh-keygen
<no passphrase>
ssh-copy-id your_login@remote.host
Now you can log in without password and use simple command in your script: sftp your_login@remote.host
2. If you use ftp:
touch ~/.netrc
echo "machine <remote_host> login <your_login> password <your_password>" > ~/.netrc
chmod 600 ~/.netrc
Now you can login in without password - ftp remote.host
Saturday, June 27, 2015
Fedora 21 bluetooth not able send/receive file
In Fedora 21, Bluetooth will not send/receive file by default. It will just act as a bluetooth speaker. To send/receive file in Fedora, you need to install Bluetooth Manager package. There are several Bluetooth manager package but I opt for Blueman.
yum install blueman
After installing this package search in apps for Bluetooth Manager. Then pair your devices. From the Bluetooth manager window you can send files.
Installing Bluetooth Manager:
To install bluetooth manager package you can run the below command as root or sudo-user.yum install blueman
After installing this package search in apps for Bluetooth Manager. Then pair your devices. From the Bluetooth manager window you can send files.
Turn on Bluetooth service
Before using the Bluetooth manger you need to start the bluetooth service as root. If you don't start the service, the bluetooth manger may not work as you expect. To turn on the bluetooth service give below command as root.
service bluetooth restart
Tuesday, June 23, 2015
Tools to get mail alert notification if disk space is full Linux
Is there any tools to get mail alert notification if disk space is full?
A single script could help you or use munin or monit toolsI guess it could help you too. So, below tools can be used.
#!/bin/bash
a=`df -h | sed '1d' | awk '$5 > 30 {print $5}' | tr -d %`
if [[ $a -ge 95 ]]
then
echo "running out of disk space"
mail -s "diskalert: $a%" yourmail@address.com
fi
OR
#! /bin/bash
mail='yourmail@address.com'
reg='^[0-9]+$'
result=`df|awk '{print $1,$5}'|tail -n+2|tr -d '%'`
for i in $result; do
if [[ $i =~ $reg ]]; then
[[ $i -gt 90 ]] && (echo $result|mail -s "Disk alert" $mail ) && break
fi
done
Tools
You can use Nagios tool and set disk alert as per your requirement. Nagios is a centralised monitoring service. If you need that only for 1 server you don't need nagios.A single script could help you or use munin or monit toolsI guess it could help you too. So, below tools can be used.
- Nagios
- Munin
- Monit
Script to monitor
Of course you need to configure your server to allow mail sending.#!/bin/bash
a=`df -h | sed '1d' | awk '$5 > 30 {print $5}' | tr -d %`
if [[ $a -ge 95 ]]
then
echo "running out of disk space"
mail -s "diskalert: $a%" yourmail@address.com
fi
OR
#! /bin/bash
mail='yourmail@address.com'
reg='^[0-9]+$'
result=`df|awk '{print $1,$5}'|tail -n+2|tr -d '%'`
for i in $result; do
if [[ $i =~ $reg ]]; then
[[ $i -gt 90 ]] && (echo $result|mail -s "Disk alert" $mail ) && break
fi
done
Monday, June 22, 2015
What does a dot in file permissions signify - Linux?
What does a dot in file permissions signify? As in rwx rwx rwx.
Following the file mode bits (rwx) is a single character that specifies whether an alternate access method such as an access control list applies to the file. When the character following the file mode bits is a space, there is no alternate access method. When it is a printing character, then there is such a method.
GNU ‘ls’ uses a ‘.’ character to indicate a file with a security context, but no other alternate access method.
A file with any other combination of alternate access methods is marked with a ‘+’ character.
Following the file mode bits (rwx) is a single character that specifies whether an alternate access method such as an access control list applies to the file. When the character following the file mode bits is a space, there is no alternate access method. When it is a printing character, then there is such a method.
GNU ‘ls’ uses a ‘.’ character to indicate a file with a security context, but no other alternate access method.
A file with any other combination of alternate access methods is marked with a ‘+’ character.
Tuesday, June 16, 2015
How to create multiple user at the time in only one command?
Simple command or script to to create multiple user at the time.
[root@localhost]# newusers
(# newusers /root/batch-user-add.txt ) you can use this command for creating a number of users at a time. try it once and check the status.
Try this :- for man info
[root@localhost]# man newusers
Linux newusers Command — Creating bulk users
Sometimes you may want to to create multiple users at the same time. Using the normal methods for bulk user creation can be very tedious and time consuming. Fortunately, Linux offers a way to upload users using new users command. This can also be executed in batch mode as it cannot ask any input.
# newusers FILENAME
This file format is same as the password file.
loginname:password:uid:gid:comment:home_dir:shell
for i in frank alex chandler teja
do
useradd $i
done
OR
for i in `cat users.txt`
do
useradd $i
done
[root@localhost]# newusers
(# newusers /root/batch-user-add.txt ) you can use this command for creating a number of users at a time. try it once and check the status.
Try this :- for man info
[root@localhost]# man newusers
Linux newusers Command — Creating bulk users
Sometimes you may want to to create multiple users at the same time. Using the normal methods for bulk user creation can be very tedious and time consuming. Fortunately, Linux offers a way to upload users using new users command. This can also be executed in batch mode as it cannot ask any input.
# newusers FILENAME
This file format is same as the password file.
loginname:password:uid:gid:comment:home_dir:shell
Shell script logic:
You can use a for loop:for i in frank alex chandler teja
do
useradd $i
done
OR
for i in `cat users.txt`
do
useradd $i
done
Wednesday, June 10, 2015
astu command in Linux
ASTU is a fictional command used in Mr.Robot TV series. He use this command to restore the hacked server. The command used in Mr.Robot TV series while fixing server are
At 30:20 minute in Mr.Robot TV series.
eterm##$ locate server WBKUW300PS345672
eterm##$ ps aux | grep root
eterm##$ ps aux | grep root | cpuset
eterm##$ astu trace -pid 344 -cmd
eterm##$ astu -ls ./root/fsociety/ -a
eterm##$ fsociety00.dat
Above commands were used by Elliot to restore the server. Among all the above commands, only ps and locate is a real Unix command. PS command is used to list the running process. According to the series, there was a rootkill running in the server. He use ps command to find out the list of running process under root user. He finds out fsociety00.dat is process that made the downtime of server.
Locate command is used to search file in your filesystem. It searches for files only in the path located in /var/lib/mlocate/mlocate.db database file.
At 30:20 minute in Mr.Robot TV series.
eterm##$ locate server WBKUW300PS345672
eterm##$ ps aux | grep root
eterm##$ ps aux | grep root | cpuset
eterm##$ astu trace -pid 344 -cmd
eterm##$ astu -ls ./root/fsociety/ -a
eterm##$ fsociety00.dat
Above commands were used by Elliot to restore the server. Among all the above commands, only ps and locate is a real Unix command. PS command is used to list the running process. According to the series, there was a rootkill running in the server. He use ps command to find out the list of running process under root user. He finds out fsociety00.dat is process that made the downtime of server.
Locate command is used to search file in your filesystem. It searches for files only in the path located in /var/lib/mlocate/mlocate.db database file.
Tamil font for Fedora
Tamil font for Fedora can be downloaded using simple yum command. The name of the tamil font is Lohit. Without this font, Tamil font were scrambled like below image:
After installing the font, the font was clear.
The font was not good before installing Lohit.
Dinamalar Website: Before installing Font |
Dinamalar website: After installing Font |
How to install?
Open Terminal & switch to Root user. Then give the below command.
yum install lohit-tamil-fonts
Terminal output:
Below is the terminal contents that I did while installing the font.
[venkat@localhost ~]$ su
Password:
[root@localhost venkat]# yum install lohit-tamil-fonts
Loaded plugins: langpacks
dvratil-plasma-5 | 3.0 kB 00:00
fedora/21/x86_64/metalink | 4.5 kB 00:00
google-chrome | 951 B 00:00
intellinuxgraphics | 951 B 00:00
rpmfusion-free | 2.5 kB 00:00
rpmfusion-free-updates | 2.7 kB 00:00
rpmfusion-nonfree | 1.2 kB 00:00
rpmfusion-nonfree-updates | 2.7 kB 00:00
updates/21/x86_64/metalink | 4.5 kB 00:00
updates | 4.9 kB 00:00
updates/21/x86_64/primary_db FAILED
http://ftp.neowiz.com/fedora/updates/21/x86_64/repodata/c0273bd2855eea5cce190a9621adc3162321068d74570c7574e0780b574f26e7-primary.sqlite.xz: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
(1/3): updates/21/x86_64/group_gz | 230 kB 00:01
(2/3): dvratil-plasma-5/21/x86_64/primary_db | 225 kB 00:02
(3/3): updates/21/x86_64/primary_db | 8.0 MB 00:14
(1/5): google-chrome/primary | 1.9 kB 00:00
(2/5): rpmfusion-nonfree-updates/21/x86_64/primary_db | 127 kB 00:00
(3/5): updates/21/x86_64/updateinfo | 1.2 MB 00:01
(4/5): rpmfusion-free-updates/21/x86_64/primary_db | 323 kB 00:01
(5/5): updates/21/x86_64/pkgtags | 1.5 MB 00:05
google-chrome 3/3
Resolving Dependencies
--> Running transaction check
---> Package lohit-tamil-fonts.noarch 0:2.91.0-2.fc21 will be updated
---> Package lohit-tamil-fonts.noarch 0:2.91.1-1.fc21 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
lohit-tamil-fonts noarch 2.91.1-1.fc21 updates 38 k
Transaction Summary
================================================================================
Upgrade 1 Package
Total download size: 38 k
Is this ok [y/d/N]: y
Downloading packages:
Not downloading deltainfo for updates, MD is 1.9 M and rpms are 38 k
lohit-tamil-fonts-2.91.1-1.fc21.noarch.rpm | 38 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction (shutdown inhibited)
Updating : lohit-tamil-fonts-2.91.1-1.fc21.noarch 1/2
Cleanup : lohit-tamil-fonts-2.91.0-2.fc21.noarch 2/2
Verifying : lohit-tamil-fonts-2.91.1-1.fc21.noarch 1/2
Verifying : lohit-tamil-fonts-2.91.0-2.fc21.noarch 2/2
Updated:
lohit-tamil-fonts.noarch 0:2.91.1-1.fc21
Complete!
Tuesday, June 9, 2015
Enable or Disable user access Linux
In Linux one user (for ex.. user named p1) is in disable mode. How to enable the user? What is the procedure?
To enable user, we should set the user to shells other than /sbin/nologin you can check available shells in file cat /etc/shells
we have changed the user shell p1 to /bin/sh. user is able to login now
usermod -s /sbin/nologin p1
[root@host-7-57 ~]# usermod -s /bin/sh p1
[root@host-7-57 ~]# su p1
sh-4.2$ bash
[root@host-7-57 ~]# usermod -s /sbin/nologin p1
[root@host-7-57 ~]# su p1
This account is currently not available.-----> no allowing user to login
[root@host-7-57 ~]# getent passwd p1
p1:x:500:500::/home/p1:/sbin/nologin
[root@localhost ~]# passwd -u p1
Unlocking password for user p1.
passwd: Success
To enable user, we should set the user to shells other than /sbin/nologin you can check available shells in file cat /etc/shells
we have changed the user shell p1 to /bin/sh. user is able to login now
usermod -s /sbin/nologin p1
[root@host-7-57 ~]# usermod -s /bin/sh p1
[root@host-7-57 ~]# su p1
sh-4.2$ bash
Disable a user
If you want user to disable . we can set the user shell to /sbin/nologin
[root@host-7-57 ~]# usermod -s /sbin/nologin p1
[root@host-7-57 ~]# su p1
This account is currently not available.-----> no allowing user to login
[root@host-7-57 ~]# getent passwd p1
p1:x:500:500::/home/p1:/sbin/nologin
Unlock a user
Sometimes if user enter wrong password for 5 times, the account gets locked. You can enable it by following command.[root@localhost ~]# passwd -u p1
Unlocking password for user p1.
passwd: Success
Tuesday, June 2, 2015
Hardlink and softlik difference with examples
when we create softlink the permission is different from source file while when we create hard link the permission is same as source file , why it is so ?
[root@host-7-25 p2]# pwd
/root/p2
[root@host-7-25 p2]# ls -ltr
total 4
-rw-r--r--. 1 root root 0 May 18 08:59 2
-rw-r--r--. 2 root root 84 May 18 09:01 1
[root@host-7-25 p2]# ls
1 2
[root@host-7-25 p2]# ln /root/p2/1 /var/hardlink1------> command used to create hardlink
hardlink has been created
[root@host-7-25 p2]# ls -li /var/hardlink1
519 -rw-r--r--. 2 root root 84 May 18 09:01 /var/hardlink1--------> harlinked file
root@host-7-25 p2]# ls -li 1
519 -rw-r--r--. 2 root root 0 May 18 08:59 1-----------> source file
Both hardlink and source file will be having same size and same inode. even source file got deleted you will be able to access the harlinked file.
But this is not case in softlinked file. in softlink if source file is deleted you will not be able to access the soflinked file.
[root@host-7-25 p2]# ls -li /var/softlink1
459 lrwxrwxrwx. 1 root root 10 May 18 09:02 /var/softlink1 -> /root/p2/1--------> soft linked file
root@host-7-25 p2]# ls -li 1
519 -rw-r--r--. 2 root root 0 May 18 08:59 1-----------> source file
source and softlinked file inode number will be different softlinked file will be less size when compared to source file. u can access softlinked file only if source file is present. if source file is delted you will not be able to access softlinked file
Its nothing but shortcut in windows
root@host-7-57 p2]# pwd
/root/p2
[root@host-7-57 p2]# ls -ltr 1
-rwxr--r--. 2 root root 84 May 18 09:01 1---------> source file
[root@host-7-57 p2]# ls -ltr /var/hardlink1
-rwxr--r--. 2 root root 84 May 18 09:01 /var/hardlink1-----------------> hardlinked file
[root@host-7-57 p2]# chmod 555 1------> permission applied on source
[root@host-7-57 p2]# ls -ltr 1
-r-xr-xr-x. 2 root root 84 May 18 09:01 1------> source file after permission change
[root@host-7-57 p2]# ls -ltr /var/hardlink1
-r-xr-xr-x. 2 root root 84 May 18 09:01 /var/hardlink1-------------> hardlinked file will also having same permission
In soflink file you cant change the permission ---- in permission sector u can see the letter l it specifies its softlink . all soflinked file will be having same permission lrwxrwxrwx.
we can use softlink only if source file exist . But this not the case in hardlink
[root@host-7-57 p2]# ls -ltr /var/softlink1
lrwxrwxrwx. 1 root root 10 May 18 09:02 /var/softlink1 -> /root/p2/1
[root@host-7-57 p2]#
[root@host-7-57 p2]# chmod 555 /var/softlink1------------> permission apllied
[root@host-7-57 p2]# ls -ltr /var/softlink1
lrwxrwxrwx. 1 root root 10 May 18 09:02 /var/softlink1 -> /root/p2/1-------------> no change after permission apllied
[root@host-7-57 p2]#
Below is examples of softlink and hardlink
Hardlink
[root@host-7-25 ~]# cd p2[root@host-7-25 p2]# pwd
/root/p2
[root@host-7-25 p2]# ls -ltr
total 4
-rw-r--r--. 1 root root 0 May 18 08:59 2
-rw-r--r--. 2 root root 84 May 18 09:01 1
[root@host-7-25 p2]# ls
1 2
[root@host-7-25 p2]# ln /root/p2/1 /var/hardlink1------> command used to create hardlink
hardlink has been created
[root@host-7-25 p2]# ls -li /var/hardlink1
519 -rw-r--r--. 2 root root 84 May 18 09:01 /var/hardlink1--------> harlinked file
root@host-7-25 p2]# ls -li 1
519 -rw-r--r--. 2 root root 0 May 18 08:59 1-----------> source file
Both hardlink and source file will be having same size and same inode. even source file got deleted you will be able to access the harlinked file.
But this is not case in softlinked file. in softlink if source file is deleted you will not be able to access the soflinked file.
Below is explaination of softlinked file
[root@host-7-25 p2]# ln -s /root/p2/1 /var/softlink1---------->command used to create softlink
[root@host-7-25 p2]# ls -li /var/softlink1
459 lrwxrwxrwx. 1 root root 10 May 18 09:02 /var/softlink1 -> /root/p2/1--------> soft linked file
root@host-7-25 p2]# ls -li 1
519 -rw-r--r--. 2 root root 0 May 18 08:59 1-----------> source file
source and softlinked file inode number will be different softlinked file will be less size when compared to source file. u can access softlinked file only if source file is present. if source file is delted you will not be able to access softlinked file
Its nothing but shortcut in windows
what about different permission of soft link and source file?
If you change the permission of harlinked file . source file permission will also change and viceversa below is example . hardlink is nothing but linking same source file to another path as backup with same size and inoderroot@host-7-57 p2]# pwd
/root/p2
[root@host-7-57 p2]# ls -ltr 1
-rwxr--r--. 2 root root 84 May 18 09:01 1---------> source file
[root@host-7-57 p2]# ls -ltr /var/hardlink1
-rwxr--r--. 2 root root 84 May 18 09:01 /var/hardlink1-----------------> hardlinked file
[root@host-7-57 p2]# chmod 555 1------> permission applied on source
[root@host-7-57 p2]# ls -ltr 1
-r-xr-xr-x. 2 root root 84 May 18 09:01 1------> source file after permission change
[root@host-7-57 p2]# ls -ltr /var/hardlink1
-r-xr-xr-x. 2 root root 84 May 18 09:01 /var/hardlink1-------------> hardlinked file will also having same permission
In soflink file you cant change the permission ---- in permission sector u can see the letter l it specifies its softlink . all soflinked file will be having same permission lrwxrwxrwx.
we can use softlink only if source file exist . But this not the case in hardlink
[root@host-7-57 p2]# ls -ltr /var/softlink1
lrwxrwxrwx. 1 root root 10 May 18 09:02 /var/softlink1 -> /root/p2/1
[root@host-7-57 p2]#
[root@host-7-57 p2]# chmod 555 /var/softlink1------------> permission apllied
[root@host-7-57 p2]# ls -ltr /var/softlink1
lrwxrwxrwx. 1 root root 10 May 18 09:02 /var/softlink1 -> /root/p2/1-------------> no change after permission apllied
[root@host-7-57 p2]#
Friday, May 29, 2015
Turn off screen reader Fedora 21
Issue:
There is no option to turn of screen reader in Fedora. How to turn of the screen reader.Solution:
There are two ways to turn of the screen reader: easy way and super easy way.The easy way:
Go to settings -> Universal Access -> Screen Reader OFF
Super easy way:
Use the shortcut key ALT + Super + S. It will open accessibility menu. There you can turn off screen reader.
Thursday, May 28, 2015
OpenShot Fedora 21 issue fixed
Issue:
After updating from Fedora 19 to Fedora 21, Openshot doesn't lauch. It shows some error in terminal likeerror: /usr/lib/libavdevice.so.53: not found
Solution:
Remove ffmpeg package
First remove the ffmpeg package. You can use the below commandyum remove ffmpeg*
It will remove all the dependencies of ffmpeg which includes VLC and Open shot. I think these package belongs to Fedora 19 and conflicts with new OS.
Install Openshot
Then install openshot by giving below command.yum install openshot
It will install all the dependencies like mlt python, ffmpeg etc. Then try launching OpenShot, it will launch.
Tuesday, May 26, 2015
Which storage technology should I choose?
There are different storage technology in IT industry like Aix cluster, ZFS etc. Now IT industries were moving from Unix to Linux. So let's see which is the best storage technology we can choose to learn that will shape our career.
SANs and NAS administration is definitely an advanced area and to be really good at it, requires a lot of advanced knowledge. But realize that each vendor tends to do things very differently. While you have common technology components like LUNs and HBAs how each vendor manages and configures these are widely different. Even between versions a vendor can turn your world up side down. That said, SANs aren't changed that often - since they're expensive and can be used for a lot of different things during their life time. So it's not a bad thing to know - and if the company you work for has a lot of data to store, they'll most likely have a SAN or NAS which is key to maintain and understand.
But ... and there is a but ... it ties you to THAT installation. Depending on how you want to plan your career that may be good or bad. Just know that going into it. You can take training and certifications with EMC and NetApps too - so like with Linux you can learn how to do things right and efficient.
Lastly - things are changing. Well they always are in IT - but within storage a big movement towards commodity storage solutions using Open Source is happening. Gluster, Ceph, FreeNAS, GFS and a lot more are all solutions giving you the same type of reliable high end storage using commodity hardware and open source software. It means you can purchase your hardware where you buy your cheap commodity servers and create high performing storage solutions yourself. That doesn't mean companies are going to throw out their current expensive and closed storage solutions - nor that they'll all use the Open Source alternatives right now. But like Linux in the early 2000s - the change is happening. Slowly but surely. In 10 years you may be considered a IT dinosaur if you're using EMC Claiion for instance - sorta like if you're planning to purchase Windows to run a large web-site today.
It's not a black and white answer. Look around you - if you have a lot of companies that uses SANs/NAS in your area it's a GREAT skill to have right now. If not - consider it a lock-in and be careful going down that road unless you know what you're doing.
SANs and NAS administration is definitely an advanced area and to be really good at it, requires a lot of advanced knowledge. But realize that each vendor tends to do things very differently. While you have common technology components like LUNs and HBAs how each vendor manages and configures these are widely different. Even between versions a vendor can turn your world up side down. That said, SANs aren't changed that often - since they're expensive and can be used for a lot of different things during their life time. So it's not a bad thing to know - and if the company you work for has a lot of data to store, they'll most likely have a SAN or NAS which is key to maintain and understand.
But ... and there is a but ... it ties you to THAT installation. Depending on how you want to plan your career that may be good or bad. Just know that going into it. You can take training and certifications with EMC and NetApps too - so like with Linux you can learn how to do things right and efficient.
Lastly - things are changing. Well they always are in IT - but within storage a big movement towards commodity storage solutions using Open Source is happening. Gluster, Ceph, FreeNAS, GFS and a lot more are all solutions giving you the same type of reliable high end storage using commodity hardware and open source software. It means you can purchase your hardware where you buy your cheap commodity servers and create high performing storage solutions yourself. That doesn't mean companies are going to throw out their current expensive and closed storage solutions - nor that they'll all use the Open Source alternatives right now. But like Linux in the early 2000s - the change is happening. Slowly but surely. In 10 years you may be considered a IT dinosaur if you're using EMC Claiion for instance - sorta like if you're planning to purchase Windows to run a large web-site today.
It's not a black and white answer. Look around you - if you have a lot of companies that uses SANs/NAS in your area it's a GREAT skill to have right now. If not - consider it a lock-in and be careful going down that road unless you know what you're doing.
Subscribe to:
Posts (Atom)