Category Archives: Uncategorized

ACL in Linux

This is a quick howto setup acl on Linux.

Sometimes we run into issue when we only wish to give certain user certain sets of permission and deny the rest. Simple rwx permission are not suffice in such situation therefore we use acls.

Setup ACL:
setfacl -R -m u:salman:rwx secret/
The above will set acl on directroy secret for user salman with read, write and execute permission recursively.

To View ACL:
getface secret
# file: secret/
# owner: apache
# group: apache
user::rwx
user:salman:rwx
group::rwx
mask::rwx
other::r-x
So we can clearly see that although the owner is apache, user salman have full permissions as well.

Thanks for Reading.
Join our FaceBook Group LHZProject “Linux Zero To Hero”
YouTube: www.youtube.com/linuxking

SSH Issue with Cisco Switch

So Today i wanted to login to my old Cisco Switch 2960 from my Suse Linux when i received the following error:

ERROR:
Unable to negotiate with 10.1.1.1 port 22: no matching key exchange method found. Their offer: diffie-helman-group1-sha1
Note**: 10.1.1.1 is ip of my switch with username salman

SOLUTION:
1) Make sure you configure ssh keys with 1024 bits when setting it up in the switch
2) From your Linux machine issue the following command:

# ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 salman@10.1.1.1

Tip**: For Debugging SSH,  use ssh -vvv option.

Thanks for Reading

Join our FB Linux Group LZH
https://www.facebook.com/groups/LZHProject
Subscribe to our YouTube Channel
https://youtube.com/linuxking

Linux Partitioning of more than 2GB Disk

So just wanted to share how to partition your hard drive from Linux command line if you have a drive greater than 2GB.

In my case its 3TB and i want to create a single partition out of it.

I used “gdisk” , its similar to “fdisk” but can create and understand large disk partitioning system.

 root@M-PVPS:/# gdisk /dev/sdb

GPT fdisk (gdisk) version 0.8.5

Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format.
THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by typing ‘q’ if
you don’t want to convert your MBR partitions to GPT format!
***************************************************************
Command (? for help):

Now we will type “p” to print partition table.

Number Start (sector) End (sector) Size Code Name
1 2048 52889599 25.2 GiB 0700 #####
2 209713152 216107007 3.0 GiB 0700 #####

Now i will delete the available partition with “d”

Command (? for help): d
Partition number (1-2): 1

Now i will delete the 2nd partition with “d” and then typing “2”

Now i will print the partitioning table with “p”

Command (? for help): p
Disk /dev/sdb: 5860533168 sectors, 2.7 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): 7F138376-657F-441A-B784-96E22BDAB49D
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 5860533134
Partitions will be aligned on 2048-sector boundaries
Total free space is 5860533101 sectors (2.7 TiB)

Now i will create the partition with “n” and selecting all the default values.

Command (? for help): n
Partition number (1-128, default 1):
First sector (34-5860533134, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-5860533134, default = 5860533134) or {+-}size{KMGTP}:
Current type is ‘Linux filesystem’
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to ‘Linux filesystem’

Now i will print the partition table with “p”

Number  Start (sector)    End (sector)  Size       Code  Name
1            2048      5860533134   2.7 TiB     8300  Linux filesystem

Now we will write and save partition with “w” command.

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.

Now we will create the file system with “mkfs -t ext3 /dev/sdb” command

root@M-PVPS:/# mkfs -t ext3 /dev/sdb1
mke2fs 1.42.5 (29-Jul-2012)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n) y

Now you can check the drive with df -h command

 

 

 

Solving Call Drop Issue in Elastix / Asterisk

If you change your Network and you find that the working Elastix / Asterisk box is now dropping calls every 15 to 25 secs.  One of the most probable reason is “NAT” .

The solution which worked for me is changing the sip_custom.conf found in /etc/asterisk/ directory.

Open it with your favorite editor such as vim or nano and add the following lines.

externip=1.1.1.1/255.0.0.0  < Your External Ip with Subnet Here >
localnet=192.168.1.0/255.255.255.0 < Your Internal Ip with Subnet Here >
canreinvite=no
NAT=Yes
Qualify=yes
promiscredir=yes

Hope this will help someone.

Thanks,
Salman

Have a Question ? Need Consultancy ? Contact US

Hi Guys , you know that you can ask for free or get free consultancy form us. So, if you want to consult with us regarding Network Setups, Linux , Security and Web Development projects Feel free to ASK !.

Here is how you can Ask !

YouTube: www.youtube.com/linuxking
Facebook Page: www.facebook.com/linuxking77
Facebook Group: www.facebook.com/groups/LZHProject/
Website: www.itpings.com

Thanks,
Sal

Bash script: Search for text in a web app

I started taking small steps into bash scripting with this little tool that help me find a lot of useful stuff in Vtiger, but it can be applyed to anything else with some little mods. This script finds files in Vtiger installation that contain the text requested. It is reporting on the file name and path and also highligsts the line than contains the text. So here is the script. Breakdown is below Continue reading

Knowing your hardware

Hi, Pingers!

Here are some useful linux commands to check out some of your computer model specs:

dmidecode -t baseboard | grep 'Product Name'
dmidecode -t processor | grep 'Socket Designation\|Version:'
dmidecode -t memory | grep 'Type\|Size' | grep -v 'Type Detail\|Error Correction Type'
 free -t -m
fdisk -l | grep 'Disk /dev/s'
hdparm -I /dev/sda | grep 'Model Number:\|Serial Number'

Merry Christmas & Happy New Year !!

Dear Members and Non-Members,

On behalf of ITpings.com i would like to wish all of you a very Happy Christmas & New year. I wish Best for all of you and may God bless you all.

Soon new posts would be published and i hope you guys will enjoy ITpings even more.

One last thing i would like to mention is that please Comment or ask questions.

If you need any help please don’t hesitate to contact us.

Best Wishes and Regards,

Admin

ITpings.com