Backtrack:  
 
showing posts tagged with 'linux'
 
edited by on September 18th 2019, at 12:02
When adding a new disk to a live system (e.g. a linux VM), the new disk may not always show up. Additionally, when resizing a disk through the hypervisor, the VM may not always immediately have the new size available for use. Luckily, you can trigger a rescan of the SCSI bus through the sysfs system.

For this to work, you'll need to have shell and root access to the server/VM.

Modern linux kernels automatically detect the addition of a disk, but in case it doesn't, you can trigger a rescan of a specific (virtual) SCSI controller:

echo "- - -" > /sys/class/scsi_host/hostX/scan

Replace hostX with the number of the SCSI controller, where host0 is the first, host1 is the second, et  ...
edited by on September 13th 2019, at 10:55
To quickly block traffic from/to a specific IPv4 address using iptables, you can use the commands below.

Warning!
Do not use these commands when you are already running an iptables-based firewall as this may result in unexpected results.

Block incoming traffic from a specific IP:

iptables -A INPUT -s 1.2.3.4 -j DROP

Block outgoing traffic (i.e. traffic initiated from the host itself) to a specific IP:

iptables -A OUTPUT -d 1.2.3.4 -j DROP

To block outgoing traffic to a specific port and protocol, you can also do something like this (the example below blocks DNS and HTTP):

/sbin/iptables -A OUTPUT -p tcp --dport 80 -d 1.2.3.4 -j DROP/sbin/iptables -A OUTPUT -p udp --dport 53 -d 1.2.3.4  ...
edited by on June 7th 2019, at 11:22

If you need to rename all folders and files to lowercase on a case-sensitive filesystem (e.g. ext4 on linux), you can use the following at the bash prompt:

If rename is available (if you have Perl installed, then it usually is):

find . -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;

If you can't use rename, try this:

for SRC in `find my_root_dir -depth`
do
    DST=`dirname "${SRC}"`/`basename "${SRC}" | tr '[A-Z]' '[a-z]'`
    if [ "${SRC}" != "${DST}" ]
    then
        [ ! -e "${DST}" ] && mv -T "${SRC}" "${DST}" || echo "${SRC} was not renamed"
    fi
done
edited by on April 24th 2019, at 13:47
Sometimes, when working on servers, you may need an USB stick to get some data over quickly. If you're working remotely on servers in a datacenter somewhere, this may not be easy. Fortunately, the remote management tools such as HPE's iLO or Dell's iDRAC provide the ability to connect virtual removable media, allowing you to map an image file as a "virtual USB stick". Although this is very neat, it still leaves you with one issue: how to get your files on such a removable media image. There are several useful tools which allow you to quickly create an USB image but one such method can also be achieved on linux systems with some of the native tools present.

The easiest method would  ...
edited by on January 8th 2018, at 10:20

You can easily test the availability of an NTP server by using ntpdate. This utility is a command line utility which performs a one-time time sync to the specified NTP server but it can also be used to query the time without setting it by using the -q parameter:

$ ntpdate -q 10.30.0.1
server 10.30.0.1, stratum 4, offset 0.001217, delay 0.04170
 8 Jan 10:19:36 ntpdate[2376]: adjust time server 10.30.0.1 offset 0.001217 sec
edited by on April 26th 2017, at 16:50

Although Debian 7 "Wheezy" (release info) has been superseded by newer releases, it still benefits from Long Term Support (LTS) until end of May 2018. In case of disaster recovery, it may still be useful to download Debian 7 install images (ISO). They can be found here:

Installing Debian 7.11

edited by on April 11th 2017, at 15:52
In Veeam, when backing up linux-based VMs with application-aware processing turned on, testing the credentials may fail even though they have been entered correctly.

First, check whether you are really using linux-credentials and not Windows credentials, this can often be overlooked very quickly.

Check whether you see the logon attempt in linux. Depending on the distro, it is logged in a file in /var/log. E.g. for Debian/Ubuntu, it's logged in /var/log/auth.log. Looking at the logging will reveal whether it is a password or SSH key problem, or something else is going on.

Another possibility is that the required cipher is not allowed. Veeam requires the cipher aes128-cbc to be enabled. Alt  ...
edited by on September 19th 2016, at 11:59
If you get a keyserver time out when trying to download a public key from a public GPG server, you may need to check your firewall settings. When receiving a public key, gpg connects to TCP port 11371, which not commonly opened up when you are behind a strict firewall. Luckily, most key servers also listen on port 80, allowing to get the public keys through that port.

When attempting to download a key and you are not able to connect to the default port, you will get something like:

gpg --keyserver keyserver.ubuntu.com --recv-keys 94558F59gpg: requesting key 94558F59 from hkp server keyserver.ubuntu.comgpg: keyserver timed outgpg: keyserver receive failed: keyserver error

To force gpg to d  ...
edited by on May 27th 2016, at 14:14

Found this page very useful when I had to compile some stuff for a Geode LX:

https://wiki.gentoo.org/wiki/Safe_CFLAGS

Note: this original post was from May 2007 but someone pointed out to me that the link no longer worked, in an attempt to sell me some web hosting... So... Thanks, but I'm sticking with my current hosting company.

edited by on January 18th 2016, at 15:10
Installing the Open Monitor Distribution (OMD) is actually pretty straight forward on Debian. Consol Labs provides a OMD repository from which the latest version of OMD can be installed, providing both a stable and testing branch.

First and foremost, you need to have a Debian/Ubuntu system running, and it needs to be connected to the internet.

In order to add the repository, you need to import the GPG security key in order to trust the repository:

gpg --keyserver keys.gnupg.net --recv-keys F8C1CA08A57B9ED7gpg --armor --export F8C1CA08A57B9ED7 | apt-key add -

Next, add the repository to your sources.list. For Debian 8.0 "Jessie", this would be something like this:

echo 'deb htt  ...
edited by on June 24th 2015, at 15:16
For proper troubleshooting of DHCP traffic, it may sometimes be necessary to capture live data on your network. There are a lot of ways on how this is accomplished, so I won't go into too much detail on all the methods available, nor will I explain what DHCP does or how it works.

DHCP (Dynamic Host Configuration Protocol) is used for automatic configuration of a host's network settings, such as IP address, gateway, routing, and more. It works by sending broadcasts using IP/UDP on ports 67 (servers) and 68 (clients). For more information on DHCP, read the explanation on Wikipedia.

In order to capture DHCP traffic, we would then have to monitor packets specifically on port 67/udp and 68/udp.  ...
edited by on June 17th 2015, at 10:34
Linux distros with a 3.x kernel running on virtualized hardware (e.g. pvscsi on VMware) may ever so often spit out the following error:

$ dmesg | grep "WRITE SAME"
kernel: sda2: WRITE SAME failed. Manually zeroing.

This is because the disk driver (in our case: the VMware paravirtual driver) does not support the WRITE SAME SCSI command, resulting in this message.

While this poses no problem for the system at all, you may want to get rid of these messages, which is done by disabling the use of the WRITE SAME command. This can be done through a bit of configuration. Most modern systems have systemd on board which can be used for this, but in case your system doesn't, there's also a  ...
edited by on June 12th 2015, at 15:55

You can efficiently change the console fonts, character sets and keymaps through the following command:

sudo dpkg-reconfigure console-setup

The configuration is stored in the file /etc/default/console-setup, and can be edited by hand as well.

The changes are effective for all virtual consoles after reboot. To apply the change for the current console, run:

setupcon

To prevent changing the console font completely (i.e. native system/BIOS font will be used), set the font to "do not change".
The equivalent in the config file is:

FONTFACE=""
FONTSIZE=""
edited by on June 9th 2015, at 16:18

Nice article about things you can do after a fresh install of Ubuntu on your computer:

http://www.tecmint.com/things-to-do-after-installing-ubuntu-15-04-desktop/

Very useful if you don't have a whole lot of experience with linux in general, and Ubuntu in particular.

edited by on June 3rd 2015, at 15:09
SMB (Server Message Block) is an application protocol, most commonly used for file and printer sharing. Although it was originally designed by IBM for use in OS/2, it has been adopted and improved upon by Microsoft as the primary protocol for file and printer sharing in their Windows for Workgroup. It has been in use ever since on Windows and a myriad of other OS flavours.

Although SMB is proprietary to Microsoft, SMB is also available on linux (through Samba), Apple (first Samba, then later, Apple's own SMBX), and a myriad of other OS vendors. In fact, Apple has replaced their own AFP in favour of SMB in their latest releases of Mac OSX. SMB has become the most commonly used protocol for f  ...
edited by on May 28th 2015, at 11:17

A nice article about how to set up NIS on Red Hat linux: http://bradthemad.org/tech/notes/redhat_nis_setup.php.

edited by on May 20th 2015, at 11:18

This is a Perl script I wrote and used for the migration of a linux DHCP server (running dhcpd to a Windows DHCP server. The script looks in the dhcpd.conf configuration file for fixed reservations and exports these to a CSV for processing and importing in another server.

Usage is simple, as it takes its input from STDIN and outputs to STDOUT.

cat /etc/dhcpd.conf | perl export-dhcpd-reservations.pl > output.csv

The script is very simple and can probably do with a lot of improvements, but it's a start for anyone willing to develop it further. It is licensed as GPLv3.

edited by on May 5th 2015, at 13:05
By default, Kodi (formerly known as XBMC), stores its data directory in the user's home folder (Mac/Linux) or roaming profile (Windows). Sometimes, this may not be desirable, especially when you have only a limited amount of space available on that particular drive (such as having a Windows installation on an small SSD). In that case, you may want to move the entire data directory (including the profiles, thumbnail caches and database files) to another drive.

There are various ways to achieve this, but I found out the most easiest (and also complete way) is to simply move the entire folder to another partition or disk, then symlink that folder to its original location. That way, you won't h  ...
edited by on June 18th 2014, at 11:53

The quick and dirty way to set up an NTP server on Debian Linux for your network.

This has been tested using Debian 7.0 "Wheezy".

1. Install NTP server:

apt-get install ntp

2. Edit /etc/ntp.conf: add the networks that are allowed to sync with your time server like so (Adjust parameters accordingly.):

restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap

3. Restart the NTP service:

/etc/init.d/ntp restart

4. Set your device/computer/server to use your NTP server

edited by on September 30th 2013, at 09:51
You can change/set the From-addresses in FreePBX to something you want.

Change the address in Admin » System Admin. To the right, click on Notification Settings, then fill in the From Address.

These are set up from within Asterisk, and are located at Settings » Voicemail Admin. Click on the Settings link, then scroll down until you find serveremail. Change it to whatever you want.

Next, because it uses Postfix to e-mail out voicemail notifications, you'll also have to change a parameter in there:

Open a shell to your box (SSH).

Type nano /etc/postfix/main.cf.

Find and change, or add a line: mydomain your-domain-name.com. Fill in the domain you want. It should be the same as  ...
 
showing posts tagged with 'linux'