Optional slush commands

8 May

Optional slush commands

These commands are located in the src\Optional\SlushCommands directory of the Slush source code. The next major section in the chapter discusses adding user and optional commands to slush. Because of size restrictions, to use them you might have to remove a current slush command.

Table 7-6: Slush optional commands

See the file slush.txt in the docs directory of your TINI installation directory
(\opt\tini\docs\slush.txt) for a description of the SLED command set.

Slush files and environment
When slush is first started, it creates several default system files, placing them in the
/etc directory. These files are
•  .tininet
•  .startup
•  passwd


User login information is kept in the /etc/passwd file. The user’s name, hash of their password, and user ID are the only things in this file. Slush has two accounts set up by default: root with the initial password of “tini” and userid of 128, and guest with the initial password “guest” and userid of 0. Valid user IDs range from 0 to 255 and have privileges assigned based on this number according to the Table 7-7:

Table 7-7: Slush UserID privileges

You can use cat  to view the passwd file. Mine looks like this right now:

You can edit this with a text editor (Sled on TINI) but there is no real need. Use the useradd and userdel commands to add and delete users and the passwd command to change user’s passwords. The password is stored as a hash using the com.dalsemi.system.Security.hashMessage() method, which is based on the “Federal Information Processing Standards Publication 180-1, Secure Hash Standard.”12

.startup file

Any user with admin permission can place commands to be run on boot time in the / etc/.startup file. These commands will be executed as if they were from a slush prompt. Any .tini program files run with the java command will be forced to run in the background.

The default .startup  file looks like this:
#Autogen’d slush startup file
setenv FTPServer enable
setenv TelnetServer enable
setenv SerialServer enable
#Add user calls to setenv here:
#Add other user additions here:

There are two main uses for this file: to set any necessary environment variables and to start your own program automatically at boot time. You can add your slush commands to the end of this file, to have them run on boot time. If you don’t want any of the servers started on boot, you can delete the appropriate lines.

Sometimes you may add commands to the .startup file but you may occasionally want to login without running them. To skip executing the contents of the .startup file, press the “5” key during the slush boot up. Slush will still enable the serial server, but will not execute the .startup file.

.tininet file
The /etc/.tininet file contains TINI’s hostname and domain name. The default hostname is TINI. There is no default domain name. You can change the contents of the file with the hostname command.

TINI /> hostname TINI.cool.net
TINI /> hostname
TINI /> cat /etc/.tininet

Also notice that the hostname is used in the Slush prompt. If you change the hostname the prompt will change to that new hostname on your next login.

TINI /> hostname astatine.element.e
TINI /> hostname
TINI /> logout
Connection Terminated
Welcome to slush. (Version 1.02)
astatine login: root
astatine password:
astatine /> hostname
astatine />

The domain name (but not the host name) may also be set using ipconfig command.

astatine /> ipconfig -n new.name
astatine /> hostname

In addition to these special files, TINI allows for an optional home directory for each user and an optional .login file for each user to customize their environment.

User Home
A directory created in the root directory with the same  name as a user will become that user’s home directory upon logging in. In other words, whatever your username is, if you create a directory in / with the same name, that will be the default login directory.

TINI /> whoami
root UID: 128
TINI /> mkdir dan
TINI /> logout
Connection Terminated
Welcome to slush.
TINI login: dan
TINI password:
TINI /dan> pwd
TINI /dan>

.login file
Any user can also place a .login file in their home directory. Every line in this file will be executed as it would be from the slush command prompt. This is very much like the .startup file but can be unique for each different user. You can comment out lines by inserting a ‘#’ at the beginning of a line.

TINI /dan> echo “echo Hi Dan, Welcome back.” > .login
TINI /> logout
Connection Terminated
Welcome to slush.    (Version 1.02)
TINI login: dan
TINI password:
Hi Dan, Welcome back. TINI /dan>

Obviously this little example is simple, but you can see the possibilities.

Servers in slush
You have already seen from looking at the slush commands and the TINI API that slush supports three servers—an FTP server, a Telnet server and a serial port server. You can check to see what servers are serving with the netstat command, and you can view who these users are with the who command.

TINI /dan> netstat
Connection count: 13

TINI /dan> who

FTP server
The FTP server listens on port 21 for connection requests. Each connection starts a new session to handle that request. You can change the configuration options for the FTP server with the following environment variables:

Telnet server
The Telnet server listens on port 23 for connection requests. Each connection starts a new session to handle that request. You can change the configuration options for the Telnet server with the following environment variables:

setenv TELNET_ALLOW_ROOT [true/false] – Allow or disallow root to
login to Telnet.   Default is

setenv TELNET_TIMEOUT [Number of ms]     – Inactivity timeout. infinite.   Default infinity.
setenv TELNET_WELCOME [file]       – File to display on successful login.
Note that any changes in the environment by changing the value of these variables will not take effect until the Telnet server is restarted.

Serial server
The Serial Server provides TTY login to the slush system. This server handles connections from JavaKit or a terminal emulator. You can change the config-uration options each serial login with the following environment variables:

Note that any changes in the environment caused by changing the value of these variables will not take effect until the Serial server is restarted. Slush is set up by default to use serial0 at 115200 bits per second. If you need to change the port, or set the speed down to 19200, you need to edit Slush.java. Change the SERIAL_PORT and SERIAL_SPEED and other variables to your needs, and rebuild. We will be discussing how to go about modifying Slush in a few sections. That about does it with Slush for now. Next, we will start working with the TINI software development tools.

Random Posts

Comments are closed.