Chattr like utility under freebsd

FreeBSD has chflags utility or command which modifies the file flags of the listed files as specified by the flags operand. See tutorial on how to Setup file immutable bit which is just like Linux chatter command. Following are flags

  • arch: set the archived flag
  • nodump: set the nodump flag
  • sappnd: set the system append-only flag
  • schg: set the system immutable flag
  • sunlnk: set the system undeletable flag
  • uappnd: set the user append-only flag
  • uchg: set the user immutable flag
  • uunlnk: set the user undeletable flag

How do I restart inetd service under Linux?

inetd is a daemon on Linux (BSD/Unix) systems that manages Internet services. inetd listens on all ports used by internet services such as FTP, POP3, and telnet. When a TCP packet or UDP packet comes in with a particular port number, inetd launches the appropriate server program to handle the connection. This uses memory more efficiently, as the other daemons do not run constantly.

Under old version of RedHat Linux you can restart inetd (login as root user):
# killall -HUP inetd

Note above command should work with almost any Linux distrobution.

New version of RedHat Linux (Fedora) comes with xinetd daemon, which can be restarted as follows:
# service xinetd restart

See also:

=> How to restart inetd under FreeBSD

Resetting RX and TX counters

You need to remove driver related to Ethernet card. Under Linux use following commands:

1) Find out driver attached to eth0 using following command
lsmod | less

2) Remove the driver using rmmod command:
rmmod driver-name

3) Again insert driver into kernel using
modprobe driver-name

For example, let us assume your driver name is 8139too , then your command should be (log in as root user):
# rmmod 8139too
# modprobe 8139too

Verify that RX and TX couters reset:
ifconfig

Under FreeBSD use following the commands:

Get list of loaded drivers, and find out ID of device driver related to Ethernet
# kldstat

Remove driver
# kldunload driver-ID

Load driver into kernel:
# kldload -v driver-name

Don’t try this command on remote server via telnet or ssh, at it will take down your connection. For more information please see
FreeBSD : How to unload (remove) device driver (module) from kernel
FreeBSD How to list device drivers (modules) loaded in memory?
FreeBSD : How to unload (remove) device driver (module) from kernel

How Do I Remotely Reboot Linux System?

A remote Linux / UNIX server can be rebooted using following methods:

A) Login to remote server using ssh as root user and use any one of the following syntax:

ssh root@remote-server-ip

OR

ssh root@remote-server-name

When prompted for password please supply remote server root password.

B) Type reboot command as follows:

reboot

You can also save time using the following reboot command over ssh session:
ssh [email protected] reboot
ssh [email protected] reboot

DesktopBSD is out!

DesktopBSD combines the stability of FreeBSD, the usability and functionality of KDE and the simplicity of specially developed software to provide a system that’s easy to use and install. Take a look at screenshots
. More info available at offical web page.

How to redirect url with perl script

It is common scenario when you need to tell the browser to redirect or look elsewhere for a page because you don’t want to produce a document yourself.

For example http://mydomain.com/rd.pl?url=http://blogs.mydomain.com should redirect to a page/url http://blogs.mydomain.com

Here is perl code to redirect web page to http://blogs.cyberciti.biz/hm/:

#!/usr/bin/perl

use strict;

use warnings;

my $url = "http://blogs.cyberciti.biz/hm/";

print "Location: $url\n\n";

However this code misses the functionality to get URL as input, this can be easily done using standard CGI module. Please see rd.pl script code.

i) Just download the rd.tar.gz script (click on download) or use wget command at shell prompt:
$ wget https://www.cyberciti.biz/download/perl_scripting/cgi/rd.pl.tar.gz

ii) Copy rd.pl script to your cgi-bin directory or directory where perl script execution allowed
iii) Suppose your domain name is cyberciti.biz and you put this script in directory called cgi-bin then to execute this script simply type http://cyberciti.biz/cgi-bin/rd.pl?url=http://www.goole.com or even ftp url http://cyberciti.biz/cgi-bin/rd.pl?url=ftp://ftp.freebsd.org/