Sunday, 8 November 2015

script to compress any photo format


Writter: Anuj Borah
Email: anujborah1@gmail.com 



script that will compress any photo with any format like .jpeg , .jpg , .png etc up to 100% . say if you have a picture of 3 mb , with this script you can compress it till 1 kb . with no degradation of quality.





#!/bin/bash
su -c 'yum install ImageMagick'

echo 'please provide the location of image file 'example ---  /home/anuj/image/anuj.jpg''
read a
echo 'please let me know how much percentage you want to compress -- 'ex- like 50%  etc''
read b
convert $a -resize $b image_new0.jpg
clear
echo 'if you want to compress more photo , run this script again'
echo ":) . Thanks have a nice day !! see u on facebook `firefox https://m.facebook.com/Mr.Anuj2223`"

Saturday, 18 July 2015

how to recover linux system after /etc file got curruped


writer - anuj borah

email- anujborah1@gmail.com




recently my Ubuntu system got crashed it was not booting . my this post will show you how to recover your Linux system after a file in /etc got damaged or mis configured.


how to recover linux installed system after /etc/fstab ,  /etc/nsswitch.conf  etc any file in /etc got damaged or mis configured .


you will be needing a boot able usb which can format your system  but here format is not a option . as a lots of stuff are there in download folder and a lots  of software are installed in your server . so format is not a option .


now i have faced the situation where i have my pc got /etc/nsswitch.conf got mis  configured as i was doing an experiment on ldap server . after shutdown it was not booting once again . i dont have a bootable ubuntu usb and i dont have any iso file through i can make bootable ubuntu usb .


i just turn on the power button of my pc , boot loader loaded , go for advance option , go for the recovery mode . you will get a shell . try to replace the /etc/nsswitch.conf  file but it show read only  file system cant change . here u can just mount the drives and make a boot able  usb copy of ubuntu .


now boot your pc with boot able usb . you will go for try ubuntu option . then

sudo su
fdisk -l

you will get the drive where the previous corrupted ubuntu was installed .
 mount it to any folder say it is /media/anuj


now

chroot /media/anuj

go for the /etc and repace nsswitch.conf file with old backed up file . dats it .

see my bellow pic how was it my pc ..

 

Sunday, 28 June 2015

Make password less ssh (script for passwordless ssh)


Make pass wordless ssh (script for password less ssh)


Writter: Anuj Borah
Email: anujborah1@gmail.com



#!/bin/bash
echo "Welcome!!! I am gonna make some passwordless ssh connection ...  coz i dont like passwords"
clear
echo "Gime me the ip of remote server u wana make password less ....."
read w
echo "Now givw me the any existing user of remote server ....."
read e
clear
echo "I will make sure that ur info is correct ....  "
ssh $e@$w mkdir -p .ssh
clear
echo "Now i gonna start my work ...  here u need to press "Enter" only when ask ..........."
ssh-keygen -t rsa
cd
cd .ssh
clear
echo "Just put the info (username and password) for the last time ...."
scp id_rsa.pub $e@$w:/home/$e/.ssh/authorized_keys
clear
echo "checking the passwordless connectivity.....Type "exit""
ssh $e@$w
clear
echo ":) . Thanks have a nice day !! see u on facebook `firefox https://m.facebook.com/Mr.Anuj2223`"

exit

Wednesday, 28 January 2015

how to share any folder of your pc over ftp or vsftp

How to share any folder of your PC over ftp or vs-ftp

say i need to  share /media/usb5/ftp folder over ftp ...

Follow the following steps:

As we know The default location on ftp is /home/user/.


* mkdir /media/usb5/ftp

now see when u do "ftp ip-of-ur-pc" from a another pc , u will have /home/user/ as default location .  so we will go  as follow.

* mount --bind /media/usb5/ftp /home/user/

and

* service vsftpd restart

dats all

put all the file u want to share over ftp on /media/usb5/ftp folder with proper
permission .

If u want to default location back ,

* umount /media/usb5/ftp

Writer: Anuj Borah
Email: anujborah1@gmail.com


Monday, 12 January 2015

solution for fstab wrongly configured

solution for  fstab wrongly configured .


Some day before i have faced a problem /etc/fstab wrongly configuration .
System was not booting .  I have tried with normal commands to edit the fstab file , but it was write protected. Finely i have got solution .  

Solution : It will work any of the version of linux .  ( Redhat , centos, fedora, ubuntu , debian etc)

(Well its not a script )




Give the root password .

type

mount -n -o remount,  rw /

and now you can edit the /etc/fstab file with vi editor .


dats all . :)


Name: Anuj Borah
Email: anujborah1@gmail.com


Popular Posts