Basic UNIX Commands for NetScaler

This article provides basic overview of UNIX commands used on the NetScaler system and basic commands for the vi editor.

Getting to the Shell Command Prompt

To get to the shell, type shell at the NetScaler CLI. To return back to the NetScaler CLI, type exit.

When in the shell, the following tips will help simplify typing and navigation:

  • Use the up or down arrow keys to use previous or next commands.

  • Use the Tab key to auto complete a command or filename.

  • Press the Tab key twice to see the available commands or filenames that match what is typed so far.

  • Use the history command to show all commands that are previously used.

  • Use the exclamation (!) symbol to execute a particular history ID. For example, !362.

Common Commands for Directories

pwd – Shows the current directory.

Example:

root@ns# pwd

/var/nstrace/

root@ns#

cd – Changes the directory to a parent directory or a subdirectory.

Examples:

rooot@ns# cd /var/nstrace/

Changes to the /var/nstrace/ directory from any point because it is explicitly from the /.

root@ns# cd ..

Changes to the parent directory.

root@ns# cd nstrace

Changes directory to nstrace from current directory.

ls – Used for listing content such as files and subdirectories in the current directory.

Examples:

root@ns# ls –al
– List files, directories and link with the following detail.

root@ns# ls –al

total 643611

drwxr-xr-x 2 root wheel 3072 Feb 15 15:05 .

drwxr-xr-x 29 root wheel 512 Feb 14 2005 ..

-rw-r–r– 1 root wheel 15370 Feb 13 15:05 dmesg.boot

-rw-r–r– 1 root wheel 15370 Feb 13 13:22 dmesg.last

-rw-r–r– 1 root wheel 15374 Feb 9 14:39 dmesg.prev

-rw-r–r– 1 root wheel 98592 Feb 17 10:03 newnslog

-rw-r–r– 1 root wheel 23194 Feb 7 09:29 newnslog.0.gz

-rw-r–r– 1 root wheel 23786 Feb 9 09:30 newnslog.1.gz

-rw-r–r– 1 root wheel 10086 Aug 2 15:53 newnslog.10.gz

permissions, owner, group, size, creation date and file name.

root@ns# ls –ltr – List files, directories sorted by date/time with the latest being the last.

Example:

root@ns# ls –ltr

total 643223

-rw-r–r– 1 root wheel 29517 May 2 2005 ns.reboots

-rw-r–r– 1 root wheel 752 May 2 2005 nslog.log

-rw-r–r– 1 root wheel 1702764 Aug 14 2005 newnslog.7.gz

-rw-r–r– 1 root wheel 1126553 Aug 16 2005 newnslog.8.gz

-rw-r–r– 1 root wheel 1191421 Aug 18 2005 newnslog.9.gz

-rw-r–r– 1 root wheel 1003186 Aug 20 15:53 newnslog.10.gz

-rw-r–r– 1 root wheel 1127304 Aug 22 15:53 newnslog.11.gz

-rw-r–r– 1 root wheel 1563115 Aug 24 15:53 newnslog.12.gz

root@ns# cd ../../../opt – Changes to the parent of the parent of the parent and to the opt subdirectory in one command.

root@ns# cd ~ – Changes directory to the users home directory from any where.

date – Used to get the date and time of a UNIX/Linux system.

Example:

root@ns# date

Tue Nov 9 12:34:14 EST 2004

ifconfig – Displays the kernel-resident network interfaces.

Example:

root@ns# ifconfig –a

lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1

inet 127.0.0.1 netmask ff000000 hme0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4>mtu 1500 index 2

inet 10.3.1.59 netmask ffff0000 broadcast 10.3.255.255 ether 8:0:20:f9:9:14

ps – Used for listing the process running on the system. ps has many switches –ax will show the most popular information.

Note: The ps command output on NetScaler does not correctly represent the process values. This is normal and great emphasis should not be placed on its output when determining the system status and load.

Example:

root@ns# ps -ax

UID PID PPID C STIME TTY TIME CMD
root 0 0 0 Nov 17 ? 0:17 sched
root 1 0 0 Nov 17 ? 0:00 /etc/init –
root 2 0 0 Nov 17 ? 2:47 pageout
root 3 0 0 Nov 17 ? 0:00 fsflush
root 292 1 0 Nov 17 ? 0:00 /usr/lib/saf/sac -t 300
root 219 1 0 Nov 17 ? 0:00 /usr/lib/utmpd

cat – This command is used to display the content of a text file. By default this command gives one full screen of text.

Example:

root@ns# cat /etc/hosts

127.0.0.1 localhost

10.3.1.59 fltr-user1-sol1 loghost

10.3.10.2 fltr-user1-1

zcat – This command is used to display the content of a text file that is compressed by gzip that has the “.gz” extension. By default this command gives one full screen of text.

Example:

root@ns# gzcat /etc/hosts.gz

127.0.0.1 localhost

10.3.1.59 fltr-user1-sol1 loghost

10.3.10.2 fltr-user1-1

less – This command is used to display the content of a text file and will allow you to scroll backwards and forwards in the file using the arrow keys.

grep – Searches the named input file(s) for lines containing a match to the given pattern.

cat <file> | grep <match>

Example:

root@ns# more ctxXtw.sh | grep ctxXtw

# ctxXtw launcher

# See the file ctxXtw.readme.

XTW=${1}ctxXtw

tail – Displays the last 10 lines of a text file.

Examples:

root@ns# tail /etc/hosts

root@ns# tail -50 /etc/hosts

You can specify a number of last lines to display by -<num>.

root@ns# tail -f /var/log.file

You can use tail to monitor a text file as it is being modified with the –f.

history – This command lists all shell commands that were previously issued.

Example:

root@ns# history

1 netstat –rn

2 exit

3 cd /etc

4 ls

5 cd group

You can use the exclamation (!) symbol with a history ID to issue the command.

Note: For more information, refer to the NetScaler Administrator’s Guide.

Related:

  • No Related Posts

File Sync between HA pair ADM is broken or not working

ADM-HA file sync is broken. ADC ns.confand backup files are not synced anymore from HA1 to HA2.

HA1:

[root@ CitrixADM:/var/mps/tenants/root/ns_conf] ls -altr */ns.conf | tail -5

-rw-rw-r– 1 pgxl nobody 692153 May 12 20:43 192.168.X.x/ns.conf

-rw-rw-r– 1 pgxl nobody 4223103 May 12 21:08 192.168.X.X/ns.conf

-rw-rw-r– 1 pgxl nobody 32625 May 13 04:48 192.168.X.X/ns.conf

HA2:

[root@ CitrixADM-Sec:/var/mps/tenants/root/ns_conf] ls -altr */ns.conf | tail -5

-rw-rw-r– 1 pgxl nobody 472707 Dec 5 20:20 192.168.X.X/ns.conf

-rw-r–r– 1 pgxl nobody 472214 Dec 5 20:20 192.168.X.X/ns.conf

-rw-rw-r– 1 pgxl nobody 3853285 Dec 6 15:34 192.168.X.X/ns.conf

From mps_config.log:

Sunday, 1 Dec 19 01:32:30.958 +0000 [Error] [DeviceFilesDownload[#61]] SCP failed for: /var/mps/tenants/root/ns_conf/tmp_194.69.x.x/ns_config.tgz

Saturday, 7 Dec 19 15:45:23.265 +0000 [Debug] [ConfigScheduler[#2]] ns_conf_file_mgr::deleteNS::directory deleted: /var/mps/tenants/root/ns_conf/192.168.x.x

Saturday, 7 Dec 19 15:45:25.938 +0000 [Debug] [ConfigScheduler[#2]] ns_conf_file_mgr::deleteNS::directory deleted: /var/mps/tenants/root/ns_conf/192.168.x.x

Saturday, 7 Dec 19 15:46:12.703 +0000 [Debug] [ConfigScheduler[#2]] ns_conf_file_mgr::deleteNS::directory deleted: /var/mps/tenants/root/ns_conf/192.168.x.x

Saturday, 7 Dec 19 15:46:35.729 +0000 [Debug] [ConfigScheduler[#2]] ns_conf_file_mgr::deleteNS::directory deleted: /var/mps/tenants/root/ns_conf/192.168.x.x

Sunday, 8 Dec 19 02:31:25.018 +0000 [Error] [DeviceFilesDownload[#98]] SCP failed for: /var/mps/tenants/root/ns_conf/tmp_192.168.X.X/ns_config.tgz

Tuesday, 10 Dec 19 03:46:08.947 +0000 [Debug] [DeviceFilesDownload[#134]] execute Command Output with error dump : tar: Error opening archive: Failed to open ‘/var/mps/tenants/root/ns_conf/tmp_192.168.x.x/ns_config.tgz’

Tuesday, 10 Dec 19 03:46:08.947 +0000 [Error] [DeviceFilesDownload[#134]] ConfFileFromNS::run::untar command “tar xzf /var/mps/tenants/root/ns_conf/tmp_192.168.x.x/ns_config.tgz -C /var/mps/tenants/root/ns_conf/tmp_192.168.x.x” returned error

Related:

  • No Related Posts

Install SEP to Remote Computers having Issue with Administrator Account

I do not need a solution (just sharing information)

After many failed, deploy SEP to computer clients many times, I have found that, 

1. If i deploy by using Build-in admin account (Enable and Set password on that account), It can success deployment BUT
2. If i deploy by using created admin account (Full Permission as build-in account), It cannot success deployment. 

So Do you have any solutions to fix this issue, due to we don’t want to enable Build-in admin account for security reason! 

NOTED: Our Computers is WORKGROUP, Not yet in Domain. FYI

0

Related:

Linux PVS Target fail to automatically or manually reset its machine account.

Follow symptoms are observed:

1. Linux PVS Targets are unable to manually or automatically reset its machine account.

2. Machine account password reset from PVS Server Console successfully resets the machine account password and the Target is able to join the domain after the reboot.

3. While running “net ads testjoin” following error is observed:

[root@MachineName ~]# net ads testjoin

kerberos_kinit_password MachineName$@Domain.com failed: Preauthentication failed

kerberos_kinit_password MachineName$@Domain.com failed: Preauthentication failed

Join to domain is not valid: Logon failure

4. Manual reset of the password by running the script “sh ad_change_pw.sh –override-timeout”, completes without any errors but the machine fails to join the domain after the reboot.

Related:

Advisory: SUDO tool vulnerability

A local privilege escalation vulnerability exists in the sudo utility and has been given CVE-2019-14287 for tracking.

Configurations that supposedly restrict a user to running commands only a different (non-root) user are not effective, allowing commands to be run as root instead.

The following sections are covered:

Applies to the following Sophos products and versions

None

The vulnerability is NOT applicable to any Sophos products.

No.

  • In relation to Sophos products: no.
  • In general: update systems frequently to receive vendor patches.

Sign up to the Sophos Support SMS Notification Service to get the latest product release information and critical issues.

If you’ve spotted an error or would like to provide feedback on this article, please use the section below to rate and comment on the article.

This is invaluable to us to ensure that we continually strive to give our customers the best information possible.

Related:

  • No Related Posts

Agent view error from enforce server

I need a solution

Hello everyone! I hope you can help me. I have a problem viewing the agent view in the administration console, but this only happens with the Administrator account (which is generated by default) with another administrator user I do not have this problem. The agents are not displayed and the buttons to perform troubleshooting do not perform any action but only occurs with this administrator user account.

I attach the screenshoot

0

Related:

  • No Related Posts

“show techsupport” fails to execute in admin partition with error ”Not authorized to execute this command“

The behavior is expected. NetScaler blocks all the noncli commands in partition for partition user under security consideration.

For show techsupport command, it’s done by executing the perl script below. Since partition user cannot run any noncli command under partition, it cannot run show techsupport either.

root@NS11# ls -l /netscaler/showtechsupport.pl

-r-xr-xr-x 1 root wheel 124927 Feb 27 18:11 /netscaler/showtechsupport.pl

Related: