:::: MENU ::::

Home

  • Apr 24 / 2017
  • 0
Linux

Find ILO IP on a HP server with Linux

If you forgot what iLO IP has been defined on your linux server and you are working remotely on it, don’t worry, you can still retrieve it with a common tool called¬†ipmitool – available on most of the distros with standard packages:

[[email protected] /]# ipmitool lan print
Set in Progress : Set Complete
Auth Type Support :
Auth Type Enable : Callback :
: User :
: Operator :
: Admin :
: OEM :
IP Address Source : Static Address
IP Address : 10.10.50.20
Subnet Mask : 255.255.255.0
MAC Address : 1a:2b:3c:4d:56:78
SNMP Community String :
BMC ARP Control : ARP Responses Enabled, Gratuitous ARP Disabled
Default Gateway IP : 10.10.50.254
802.1q VLAN ID : Disabled
802.1q VLAN Priority : 0
RMCP+ Cipher Suites : 0,1,2,3
Cipher Suite Priv Max : XuuaXXXXXXXXXXX
: X=Cipher Suite Unused
: c=CALLBACK
: u=USER
: o=OPERATOR
: a=ADMIN
: O=OEM

If you’re getting such an error when you are using the command:

[[email protected] /]# ipmitool lan print
Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory

This means you just need to enable some modules before:

[[email protected] /]# modprobe ipmi_devintf
[[email protected] /]# modprobe ipmi_si
  • Apr 13 / 2017
  • 0
Linux

Quit telnet – Escape character

Stuck with a telnet session that refuses to give you hand back on console?
No worries… You just have to know the correct command to sort this out!

When you are opening a telnet connection, you probably got something like:

[email protected]# telnet 127.0.0.1 80
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.

So, if you want to quit, you just have to use the “escape character” as indicated. But this character is not designed to be typed with 2 characters like “^” and then “]” – you have to use a direct command that can be different depending on your OS:

  • Windows: Ctrl + $
  • Linux: Ctrl + Alt Gr + ]
  • Mac OS: Ctrl + $

And press Enter once you inserted this escape character so you can get the standard telnet prompt and be able to type quit to exit the prompt.

This will result in a command like:

^]
telnet> quit
Connection closed.
[email protected]#

And here you go – you’re out of telnet ūüôā !

  • Apr 07 / 2017
  • 0
Linux

Display time with history command

When you are using the¬†history¬†command on a UNIX system, by default, you’re only getting an action list with numbers but no date and/or time to complete this history. For that, you have to define an environment variable¬†HISTTIMEFORMAT¬†that will describe how you want to display the timestamp for each command.

To display the timestamp temporarily (during session), you can just export the variable before sending the command:

$export HISTTIMEFORMAT="%d/%m/%y %T " ; history

You will get:

2021  01/04/17 11:54:04 systemctl list-units
2022  01/04/17 11:54:10 systemctl list-unit-files
2023  01/04/17 11:54:15 cd /etc/
2024  01/04/17 11:54:33 ls -lsta
2025  01/04/17 11:54:33 ps auxw | grep apache
2026  01/04/17 11:54:35 date
2027  01/04/17 11:54:35 cd ..
2028  01/04/17 11:54:37 cd /var/log
2029  01/04/17 11:54:37 ls -lsta
2030  01/04/17 11:54:40 cat messages
2031  01/04/17 15:48:44 history
2032  01/04/17 15:48:51 export HISTTIMEFORMAT="%d/%m/%y %T " ; history

If you want to keep that display for a future session, you have to add this variable to your bash profile and reload your profile:

$echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile
$source ~/.bash_profile
  • Mar 29 / 2017
  • 0
Uncategorized

MonitWeb – Architecture and security

Check instantly your infrastructure health like certificate expiration or unexpected opened ports. Stay updated with daily security feeds and get custom and automated reports.

Need further assistance for designing your architecture or get some security insights for an existing app? Get in touch with experts to get custom and complete assistance!

MonitWeb: https://www.monitweb.com

  • Mar 24 / 2017
  • 0
Linux

Create multiple symlink by changing name with command find

Let’s imagine that we have the following directory listing:

$ ls -ls /data/db1/
total 4778688
   1488 -rw-r--r-- 1 dbmaster      760264 Feb 14 00:20 database_2016_file1
    496 -rw-r--r-- 1 dbmaster      251529 Dec 29 12:45 database_2016_file2
 808960 -rw-r--r-- 1 dbmaster   414187520 Jan 30 10:20 database_2016_file3
    344 -rw-r--r-- 1 dbmaster      172544 Mar 18 00:42 database_2016_file4
 958528 -rw-r--r-- 1 dbmaster   490764886 Feb  7 12:18 database_2016_file5
  19480 -rw-r--r-- 1 dbmaster     9970189 Mar  2 17:31 database_2016_file6
2813952 -rw-r--r-- 1 dbmaster  1440743424 Mar 20 10:00 database_2016_file7
 160336 -rw-r--r-- 1 dbmaster    82088969 Mar 22 10:30 database_2016_file8
  14632 -rw-r--r-- 1 dbmaster     7490048 Mar 16 16:13 database_2016_file9
    104 -rw-r--r-- 1 dbmaster       51525 Mar  2 16:18 database_2016_idx1
     32 -rw-r--r-- 1 dbmaster       16114 Dec 14 18:55 database_2016_idx2
    144 -rw-r--r-- 1 dbmaster       71056 Dec  6 13:32 database_2016_idx3
     40 -rw-r--r-- 1 dbmaster       18214 Mar  9 12:38 database_2016_idx4
    104 -rw-r--r-- 1 dbmaster        8686 Jan  5 09:10 database_2016_idx5
     48 -rw-r--r-- 1 dbmaster       21316 Dec 14 20:01 database_2016_idx6

We would like to get a copy of those files named 2016 with a new name for the 2017 year, but we need to keep same content and retro-compatibility. For that, it’s easier to create some symbolic links of all those files instead of doing copies.

You can so use this command for creating those symlinks:

find /data/db1/ -type f -name "database_2016*" -exec bash -c 'ln -s $1 ${1/2016/2017}' -- {} ;

We are now getting this, as expected:

$ ls -ls /data/db1/
total 4778808
   1488 -rw-r--r-- 1 dbmaster      760264 Feb 14 00:20 database_2016_file1
    496 -rw-r--r-- 1 dbmaster      251529 Dec 29 12:45 database_2016_file2
 808960 -rw-r--r-- 1 dbmaster   414187520 Jan 30 10:20 database_2016_file3
    344 -rw-r--r-- 1 dbmaster      172544 Mar 18 00:42 database_2016_file4
 958528 -rw-r--r-- 1 dbmaster   490764886 Feb  7 12:18 database_2016_file5
  19480 -rw-r--r-- 1 dbmaster     9970189 Mar  2 17:31 database_2016_file6
2813952 -rw-r--r-- 1 dbmaster  1440743424 Mar 20 10:00 database_2016_file7
 160336 -rw-r--r-- 1 dbmaster    82088969 Mar 22 10:30 database_2016_file8
  14632 -rw-r--r-- 1 dbmaster     7490048 Mar 16 16:13 database_2016_file9
    104 -rw-r--r-- 1 dbmaster       51525 Mar  2 16:18 database_2016_idx1
     32 -rw-r--r-- 1 dbmaster       16114 Dec 14 18:55 database_2016_idx2
    144 -rw-r--r-- 1 dbmaster       71056 Dec  6 13:32 database_2016_idx3
     40 -rw-r--r-- 1 dbmaster       18214 Mar  9 12:38 database_2016_idx4
    104 -rw-r--r-- 1 dbmaster        8686 Jan  5 09:10 database_2016_idx5
     48 -rw-r--r-- 1 dbmaster       21316 Dec 14 20:01 database_2016_idx6
      8 lrwxr-xr-x 1 dbmaster          30 Mar 24 13:59 database_2017_file1 -> /data/db1/database_2016_file1
      8 lrwxr-xr-x 1 dbmaster          30 Mar 24 13:59 database_2017_file2 -> /data/db1/database_2016_file2
      8 lrwxr-xr-x 1 dbmaster          30 Mar 24 13:59 database_2017_file3 -> /data/db1/database_2016_file3
      8 lrwxr-xr-x 1 dbmaster          30 Mar 24 13:59 database_2017_file4 -> /data/db1/database_2016_file4
      8 lrwxr-xr-x 1 dbmaster          30 Mar 24 13:59 database_2017_file5 -> /data/db1/database_2016_file5
      8 lrwxr-xr-x 1 dbmaster          30 Mar 24 13:59 database_2017_file6 -> /data/db1/database_2016_file6
      8 lrwxr-xr-x 1 dbmaster          30 Mar 24 13:59 database_2017_file7 -> /data/db1/database_2016_file7
      8 lrwxr-xr-x 1 dbmaster          30 Mar 24 13:59 database_2017_file8 -> /data/db1/database_2016_file8
      8 lrwxr-xr-x 1 dbmaster          30 Mar 24 13:59 database_2017_file9 -> /data/db1/database_2016_file9
      8 lrwxr-xr-x 1 dbmaster          29 Mar 24 13:59 database_2017_idx1 -> /data/db1/database_2016_idx1
      8 lrwxr-xr-x 1 dbmaster          29 Mar 24 13:59 database_2017_idx2 -> /data/db1/database_2016_idx2
      8 lrwxr-xr-x 1 dbmaster          29 Mar 24 13:59 database_2017_idx3 -> /data/db1/database_2016_idx3
      8 lrwxr-xr-x 1 dbmaster          29 Mar 24 13:59 database_2017_idx4 -> /data/db1/database_2016_idx4
      8 lrwxr-xr-x 1 dbmaster          29 Mar 24 13:59 database_2017_idx5 -> /data/db1/database_2016_idx5
      8 lrwxr-xr-x 1 dbmaster          29 Mar 24 13:59 database_2017_idx6 -> /data/db1/database_2016_idx6
  • Mar 05 / 2017
  • 0
Linux

Use wget/curl behind a proxy

If your machine is behind a proxy, you probably configured your browser for going through the proxy to reach Internet. But what about command line with curl and wget?

If you want to add the proxy temporarily for some few installations for example, just type (by replacing URL and port with yours):

export http_proxy=http://MyProxyURL:3128
export https_proxy= http://MyProxyURL:3128

If you want to make the changes globally and keep it after a restart (or a new login), you can:

  • Add those lines in ~/.wgetrc to make it available only for wget and for the current user
    http_proxy=http://MyProxyURL:3128
    https_proxy=http://MyProxyURL:3128
    use_proxy=on
    wait=15
    
  • Add those lines in /etc/environment to make it work for either curl/wget or any http relevant command:
    http_proxy=http://MyProxyURL:3128
    https_proxy=http://MyProxyURL:3128
    

If you need authentication, you can simply include username and password in your connection string like:

http_proxy = http://username:[email protected]:3128
Pages:12345678...18
Question ? Contact