User Tools

Site Tools


Sidebar

devices:mybookworld:shell

Shell Tips and Tricks

Requirements

To apply the fallowing patches you need to access the device throw SSH and to have root privileges

  1. Start SSH server – Access the Admin web interface to enable the SSH support.
  2. Connect to the device using a ssh client (Putty) and log as a normal user.
  3. Change the user in root.
$ su -

<note warning>The author and the development team do not assume responsability for any harm or loss you may suffer if you execute the fallowing code. The information provided is considered experimental and if you don't know what you are doing you may crash your device for good.</note>

Configure Optware

  1. Start SSH server – Access the Admin web interface to enable the SSH support.
  2. Configure Optware – Install software package repositories support
  3. Add optware binaries to system path.
  • edit /etc/profile to change PATH for all users except root.
export PATH=\
/bin:\
/sbin:\
/usr/bin:\
/usr/sbin:\
/usr/bin/X11:\
/usr/local/bin:\
/opt/bin
  • edit /root/.bashrc to change PATH for root.
export PATH=\
/bin:\
/sbin:\
/usr/bin:\
/usr/sbin:\
/usr/bin/X11:\
/usr/local/bin:\
/opt/bin

Install Midnight Commander

  • Update local feed list.
# ipkg update
  • Search for mc package.
# ipkg list mc
mc - 4.6.1-3 - Midnight Commander File Manager
Successfully terminated.
  • Download and install the package.
# ipkg list mc

Edit Files with mc

  • Start Midnight Commander.
# mc
  • Navigate in the files system using arrow keys and ENTER.
  • Move the cursor on the desired file and press F4.
  • This will open internal editor.
  • To save changes press F2.
  • To exit press ESC.

Edit Files with vi

vi is a text editor (program) that can be used to create and modify text files.

  • Create a new blank file
# vi new_file
  • Open existing file
# vi existing_file
  • By default vi enters the command-mode.
  • The command-mode is used to perform actions on the file
  • The insert-text-mode is used to edit file's text contents
  • To enter insert-text-mode press i.
  • To exit insert-text-mode and enter command-mode press ESC.
  • To exit vi and save the file, in command-mode type ZZ.
  • To find the first instance of a string type /string_to_search
  • To delete a single character press x
  • To delete a whole line type dd
Command Description
h move cursor one character to left
j move cursor one line down
k move cursor one line up
l move cursor one character to right
w move cursor one word to right
b move cursor one word to left
0 move cursor to beginning of line
$ move cursor to end of line
nG move cursor to line n
CTRL-f scroll forward one screen
CTRL-b scroll backward one screen
i insert to left of current cursor position (end with ESC)
a append to right of current cursor position (end with ESC)
dw delete current word (end with ESC)
cw change current word (end with ESC)
r change current character
~ change case (upper-, lower-) of current character
dd delete current line
D delete portion of current line to right of the cursor
x delete current character
ma mark currrent position
d`a delete everything from the marked position to here
`a go back to the marked position
p dump out at current place your last deletion (paste)
u undo the last command
. repeat the last command
J combine (join) next line with this one
:w write file to disk, stay in vi
:q! quit VI, do not write file to disk,
ZZ write file to disk, quit vi
:r filename read in a copy of the specified file to the current buffer
/string search forward for string (end with Enter)
?string search backward for string (end with Enter)
n repeat the last search (``next search'')
:s/s1/s2 replace (substitute) (the first) s1 in this line by s2
:lr/s/s1/s2/g replace all instances of s1 in the line range lr by s2
:map k s map the key k to a string of vi commands s (see below)
:abb s1 s2 expand the string s1 in append/insert mode to a string s2

An advanced tutorial can be found at: An Extremely Quick and Simple Introduction to the Vi Text by Norm Matloff

Manage Files with WinSCP

WinSCP is an open source SFTP client and FTP client for Windows. Its main function is the secure file transfer between a local and a remote computer. Beyond this, WinSCP offers basic file manager functionality. It uses Secure Shell (SSH) and supports, in addition to Secure FTP, also legacy SCP protocol.

Features

<blockquote>

  • Graphical user interface.
  • Translated into several languages.
  • Integration with Windows (drag&drop, URL, shortcut icons).
  • U3 support.
  • All common operations with files.
  • Support for SFTP and SCP protocols over SSH-1 and SSH-2 and plain old FTP protocol.
  • Batch file scripting and command-line interface.
  • Directory synchronization in several semi or fully automatic ways.
  • Integrated text editor.
  • Support for SSH password, keyboard-interactive, public key and Kerberos (GSS) authentication.
  • Integrates with Pageant (PuTTY authentication agent) for full support of public key authentication with SSH.
  • Windows Explorer-like and Norton Commander-like interfaces.
  • Optionally stores session information.
  • Optionally supports standalone operation using a configuration file in place of registry entries, suitable for operation from removable media.

<cite>Official website, Introducing WinSCP</cite> </blockquote>

Configuration

  • Open WinSCP program.
  • Check Advanced options checkbox if not checked.
  • Access Session ⇒ Stored Sessions.
  • Press New button.
  • Fill the connection form:
WinSCP login
Host Name: DEVICE_NAME Port Number: 22
Username: USERNAME Password: PASSWORD
Private Key File:
File Protocol: SCP

(where DEVICE_NAME may by the IP or the NAME of your MYBOOK).

  • Press Save button to save connection data.

<note tip>To ensure security do not specify any USERNAME or PASSWORD. They will be asked later.</note>

  • To have root privileges access Environment ⇒ SCP/Shell.
  • In the Shell box replace “default” with “su -”.
  • Access Preferences to change the program interface
    • Norton Commander - similar to Norton Commander, Midnight Commander, Dos Navigator
    • Explorer-like - similar to Windows File Explorer
  • Press Login button to start the session
  • After connection is established double click on the “locker” icon in the right part of the status bar.
Server and Protocol Information
Protocol
Item Value Description
Remote System Linux DEVICE_NAME 2.6.17.14 #1 … Device signature
Session Protocol SSH-2 Secure Shell
SSH Implementation OpenSSH_3.9p1 OpenSSH
Encryption algorithm aes Advanced Encryption Standard
Compression No Data compression
File transfer protocol SCP SCP
Capabilities
Item Value
Can change permissions Yes Linux file permissions
Can change owner/group Yes Change a file's owner and group
Can execute arbitrary command Yes Learning the shell
Can create symlink/hardlink Yes/Yes Hardlinks and Symlinks
Can lookup user groups Yes Linux Command: groups
Can duplicate remote files Yes linux Command: cp
Can check available space No
Can calculate file checksum No
Native text (ASCII) mode transfers No
devices/mybookworld/shell.txt · Last modified: 2008/05/04 08:44 (external edit)