انجمن مدیران و راهبران شبکه

انجمن مدیران و راهبران شبکه

Network Managers and Administrators
انجمن مدیران و راهبران شبکه

انجمن مدیران و راهبران شبکه

Network Managers and Administrators

Disable Storing History of Commands in LINUX

سلام،

بعضی از ادمین ها علاقه دارند به منظور رعایت مسائل امنیتی، History ترمینال لینوکس رو غیر فعال کنند تا سایر کاربران سرور دستوراتی که اونا تایپ کردن رو نتونن ببینن. برای اینکار 2 تا روش خیلی ساده وجود داره:

  • روش موقت که در این روش کافیست بعد از اینکه کارتون با سرور تمام شد دستور زیر رو بزنید تا History پاک بشه.
[iman@kali ~]$ history -c
  • راه دوم و اساسی اینه که برید فایل bash_profile رو ادیت کنید که دیگه بصورت دائم و برای همه یوزرها hystory غیرفعال بشه.


[iman@kali ~]$ nano .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
HISTSIZE=0
.bash_profile (END)
export PATH

[iman@kali ~]$ source .bash_profile

مراحل ریست نمودن پسوورد یوزر ROOT در لینوکس

If you forgot your root password for your debian server use the following procedure to reset.

Boot to the GRUB menu. Then, press <e> (for edit) before Linux has a chance to boot.


Using your keyboard arrow keys, move the cursor down a line or so, and press <e> (for edit) again, you should now be on the kernel line, and press <End> to go out to the very end of that line. Now hit the spacebar once, if necessary, to add a space, and then add one of the folllowing:


init=/bin/bash


or


init=/bin/sh


Then press <Enter>, and you're back at the kernel line, press <b> (for boot) and the computer will proceed to boot to a root prompt.


At this point, the root file system is still mounted read-only, so enter the following command:


mount -n -o remount,rw /


Then type:


passwd


Enter your new password. Retype if asked to confirm.

Then restart the machine by typing:


reboot


Now you should be able to login with your new root password as required.

نحوه تنظیم Static Route بصورت ثابت بر روی سرور لینوکس




To keep the Static Route persistent on Linux or you want to add the route entries to the network

 script files (not using the route command) then all you need to do is to edit the file

/etc/network/interfaces

and the static routes in the following format:

up route add [-net|-host] <host/net>/<mask> gw <host/IP> dev <Interface>

Example

up route add -net 172.20.11.0/16 gw 172.20.10.254 dev eth1

And the file will like the following

sudo cat /etc/network/interfaces

The output should show something like this

sudo cat /etc/network/interfaces

The output should show something like this

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0 eth1

iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
# dns-* options are implemented by the resolvconf package, if installed

iface eth1 inet static
address 172.20.10.1
netmask 255.255.255.0
broadcast 172.20.10.255
gateway 172.20.10.254

# static route
up route add -net 172.20.11.0/16 gw 172.20.10.254 dev eth1

The above has 2 Ethernet interfaces and the static route is added to the interface eth1.

For the change to /etc/network/interface to take effect. please restart the "networking" service as follows:

sudo /etc/init.d/networking restart

NOTE: If you added the route already using the "route" then there is no need to restart the networking service because, the next time server is restarted this takes effect.

نحوه تنظیم Time Zone بر روی Debian Linux






Linux Debian - Set Time Zone



  جهت تنظیم Time Zone بر روی سرور لینوکس Debian از دستور زیر استفاده می شود:


dpkg-reconfigure tzdata

نحوه تنظیمات IP Address بصورت Permanent در لینوکس







  • vi /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1

  • /etc/init.d/networking restart
  • vi /etc/hosts

127.0.0.1       localhost.localdomain   localhost
192.168.0.100   server1.example.com     server1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts