Linux Programmer | RHCE | RHCSA

Search This Blog

Saturday 30 December 2017

Folder not deleted from root folder with root user

check the /root/.bashrc script

you can check the aliases are created or not for some commands like kill,killall,chattr

if you found anything like this then remove  it

then write the below command to check the attributes of the folder which is not deleted.

lsattr /root/.folder_name

if this will show the output like
----i-----e-----  /root/.folder_name

you can follow the article below

Attribute “i

Sometimes it might be very useful to render a file immutable – nobody (not even the root user) will be able to edit, rename, move or delete this file. The way to do that on a Linux file system is by using file attributes (also called flags) and more specifically the “i“-immutable file attribute.
On a Linux system, there are two commands for working with file attributes. These are:
  • chattr – this is the command, which is used to set file attributes to files. Some attributes, including the immutable attribute can only be set by the superuser.
  • lsattr – this is the command that is used to display the attributes currently set for a file.
I will illustrate the use of file attributes by the simple example below:
We create an empty file:
root@server:~# touch example.txt
Let’s list the current attributes of this file:
root@server:~# lsattr example.txt
-----------------e- example.txt
As you can see the only flag set for this newly created file is the “e” flag which is on by default for all Linux files on an ext4 file system.
Now, let’s set the “i” flag for this file. Remember that by default, only a superuser can do this:
root@server:~# chattr +i example.txt
Let’s list the attributes now:
root@server:~# lsattr example.txt
----i------------e- example.txt
As you can see the “i” flag is visible now.
To test the functionality, I will try to modify the file in several ways:
root@server:~# mv example.txt renamed.txt
mv: cannot move `example.txt' to `renamed.txt': Operation not
permitted

root@server:~# rm -f example.txt
rm: cannot remove `example.txt': Operation not permitted

root@server:~# echo "Some string" > example.txt
bash: example.txt: Permission denied
As can be seen from the above examples, we cannot move, delete or add content to this file.
To remove the immutable attribute from a file you need to use the chattr command again. For example:
root@server:~# chattr -i example.txt
root@server:~# lsattr example.txt
-----------------e- example.txt

Attribute “a

Another useful file attribute is the “a” attribute. The “a” stands for “append” and this flag indicates that a file can only be opened for append operations, i.e. additional content can only be added to the file but none of the existing content can be modified.
The functionality can be easily illustrated with the example below:
First, set the “a” attribute:
root@server:~# chattr +a example.txt
root@server:~# lsattr example.txt
-----a-----------e- example.txt
Next, attempt to modify the file:
root@server:~# rm -f example.txt
rm: cannot remove `example.txt': Operation not permitted

root@server:~# mv example.txt renamed.txt
mv: cannot move `example.txt' to `renamed.txt': Operation not
permitted

root@server:~# echo "replacing content" > example.txt
bash: example.txt: Operation not permitted

root@server:~# echo "appending new content" >> example.txt
Only the last operation that we attempted on this file was successful because it just appended the “appending new content” string to the end of the file without modifying its existing content.

Monday 6 November 2017

error while installing openssh-serer

Monday 21 August 2017

How to configure Grive for Linux ?

1. download the grive source code repository

2. install dependency packages

     apt-get install git cmake build-essentia libgcrypt11-dev libyajl-dev libboost-all-dev libcurl4-openssl-dev libexpat1-dev libcppunit-dev binutils-dev

3. extract downloaded grive source code folder 
unzip {grive}.zip

4. cd grive-master

5. create debian package 

dpkg-buildpackage -j2 
( here, j2 is no of cpu, you can check it by lscpu)

6. mkdir build
cd build
cmake ..

if error of yajl during cmake then, install yajl-tools & apt-get install yajl* package

make -j2
sudo make install

Friday 12 May 2017

Epson Printer drivers for ubuntu

Epson LQ 300 Printer Driver for Linux (Dot Matrix Printer)


1. Download the ppd file from the below link

https://drive.google.com/file/d/0BwPBGrPmbppAeEFJOUEwQUZqWE0/view?usp=sharing&resourcekey=0-QTrazqgT1tIq9TEpOeg_qg

https://drive.google.com/file/d/0BwPBGrPmbppAd2xPZ2NuQ0E5QkU/view?usp=sharing&resourcekey=0-Xwsc5mlwlAselhRK-ouOSw

2. copy both files at below location

cp  epson-en-eplq300.ppd.gz /usr/share/cups/model/

cp Epson-Dot_Matrix-epson.ppd /usr/share/cups/model/

3. change the permission of the driver files

chmod 0777 /usr/share/cups/model/Epson*

chmod 0777 /usr/share/cups/model/epson*

4. set dpi into the printer settings

182 DPI (in capital)


Epson TM-T81,TM-T82 Series Printer Drivers for linux

1. Download the driver from the below link:
https://drive.google.com/file/d/0BwPBGrPmbppAM09OWGNjT1BWZWM/view?usp=sharing&resourcekey=0-gax_Vm6YY_YPU7aeWAf62Q

2. Extract the downloaded file

3. go to the location where zip file is extracted

4. bash ./install.sh

Now check the driver list of Epson

Epson Thermal Printers  Drivers are now available.

RP-3200 STAR Printer Driver For ubuntu

Download driver from below link
and extract the zip file
https://drive.google.com/file/d/0BwPBGrPmbppAZzVlQndDSjgxb2c/view?usp=sharing&resourcekey=0-nnLT380dw2R5_z8Vnfw9lw


Epson L380 Printer Driver for Ubuntu

https://drive.google.com/file/d/0BwPBGrPmbppAVVhIWGlWS2pjaTQ/view?usp=sharing&resourcekey=0-yLUEFXuwfiiBGKYTEp1Cmg







Friday 20 January 2017

refresh icons on pcmanfm desktop

sometimes new created icons are not showing on pcmanfm desktop

1. craete file /path/to/script/refresh.sh

#!/bin/sh
pcmanfm --desktop-off
pcmanfm --desktop --profile LXDE &

2. chmod +x /path/to/script/refresh.sh

Double click on script, the items on desktop is now displaying.

Thursday 12 January 2017

system-config-printer !!

List only connected Printers on Local machine 

             The important part here is the "device-URI". This way you tell CUPS which backend it shall use with the printer "printername". The backends for most types of local printers are already part of the CUPS package. CUPS 1.1.x contains backends for parallel, serial, and USB printers, CUPS 1.2.x will also support FireWire (IEEE 1394) and SCSI printers.

            The backends do not only send data to the appropriate devices. They are also called when CUPS is started. They auto-detect which printer models are connected to which ports. So you should set up your BIOS for the parallel ports to allow bi-directional communication. Then your printer(s) can answer to the auto-detection requests.
To see which devices the CUPS backends auto-detect currently, execute them without command line options:

   $ /usr/lib/cups/backend/usb
   direct usb:/dev/usb/lp0 "HP PSC 950xi" "USB Printer #1"
   direct usb:/dev/usb/lp1 "EPSON USB Printer" "USB Printer #2"
   direct usb:/dev/usb/lp2 "EPSON USB Printer" "USB Printer #3"
   direct usb:/dev/usb/lp3 "Unknown" "USB Printer #4
 
 
List Installed Printers  
        this will list the printers which is installed in local machine.
lpstat -p | awk '{print $2}' | xargs -n1 lpq -P | grep -i "ready" 
 
 
================== Other Options ================
  • /usr/bin/lp - Used to submit print jobs
  • /usr/bin/lp.cups - Used to submit print jobs
  • /usr/bin/lpoptions - Gets and sets printer options for a single user when run by a user or for the system when used by root
  • /usr/bin/lppasswd - Changes printing passwords for an individual user or adds, deletes, and changes printer users and passwords when run by root
  • /usr/bin/lpq - Shows the status of a printer queue
  • /usr/bin/lpq.cups - Shows the status of a printer queue
  • /usr/bin/lpr - Used to submit print jobs
  • /usr/bin/lpr.cups - Used to submit print jobs, forcing use of CUPS
  • /usr/bin/lprm - Used to remove print jobs from a queue
  • /usr/bin/lprm.cups - Used to remove print jobs from a queue
  • /usr/bin/lpstat - Gives status of the CUPS system, such as queue lengths and printers
  • /usr/bin/lpstat.cups - Gives status of the CUPS system, such as queue lengths and printers
  • /usr/bin/cancel - Cancels a print job
  • /usr/bin/enable - Enables a print queue or class of printers, requires a management password
  • /usr/bin/disable - Disables a print queue or class of printers, requires a management password
  • /usr/sbin/lpadmin - Manages printers and classes, requires a management password
  • /usr/sbin/lpc - A compatibility program for Berkley style printers, limited to queue status in CUPS
  • /usr/sbin/lpc.cups - A compatibility program for Berkley style printers, limited to queue status in CUPS
  • /usr/sbin/lpdomatic - A filter script provided to be used in setting up printers
  • /usr/sbin/lpinfo - Shows available printer devices and drivers on the system
  • /usr/sbin/lpmove - Moves the jobs destined for a queue to another queue

These commands only work when you're logged in as root, either when you log in or after switching to root using the su command:
  • /usr/bin/lprsetup.sh - A shell script provided to help set up ghostscript printers
  • /usr/sbin/accept - Causes the print queue to accept requests
  • /usr/sbin/reject - Causes the print queue to reject requests
 

Monday 9 January 2017

Disable right click on Lxpanel

Download Source code of LXpanel

cd /opt
https://drive.google.com/open?id=0BwPBGrPmbppATGw4X193OTdvUVk

Now, Extract downloaded .tar file

tar -xf lxpanel-0.9.2.tar.xz

cd lxpanel-0.9.2

open README file and Follow The instructions to Download dependency packages
                              OR
Download the dependency packages List from below link,
https://drive.google.com/open?id=0BwPBGrPmbppAQmJ3SUZ3T1lHY3c

cp lxpanel_dependency.tar /tmp

cd /tmp
tar -xf lxpanel_dependency.tar
( This .tar file contains the .deb files, install .deb files  )
dpkg -i *.deb


cd /opt/lxpanel-0.9.2/src

nano input-button.c

search for "on_button_press_event"

{
// comment code inside this function
}

nano plugin.c

search "lxpanel_plugin_button_press_event"
{
// comment code inside the function
}
 OR
Download the source files and replace it
input-button.c
https://drive.google.com/open?id=0BwPBGrPmbppAYW1pandEUHZac1k

plugin.c
https://drive.google.com/open?id=0BwPBGrPmbppAdmNsWC1UTWpqUUU



cd /opt/lxpanel-0.9.1/

(Configure the source code of lxpanel)
./configure --prefix=/usr

make 

make install
lxpanelctl restart



SSH not working with password after upgrade ubuntu 22.04

Issue: In recent upgrade of ubuntu 22.04 we are not able to login server with SSH password. but when we try to login with key then it allow...