Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Enjoy members-only rewards and discounts
  • Create and access a list of your products
  • Manage your Dell EMC sites, products, and product-level contacts using Company Administration.
Some article numbers may have changed. If this isn't what you're looking for, try searching all articles. Search articles

PowerStore: Understanding shell limitations due rbash and other security implementations

Summary: In order to harden overall security, a decision was made to lock down the PowerStore shell by enabling rbash (restricted bash shell) and other security implementations. Another example is that the service user home folder is /home/service/user and not /home/service as possibly expected. This is one of the few places the service user has write permissions on. ...

This article may have been automatically translated. If you have any feedback regarding its quality, please let us know using the form at the bottom of this page.

Article Content


Symptoms

Possible errors observed as a result of these measures:

  • rbash: cd: restricted (when trying to navigate through the directories)
  • rbash: xxxx: restricted: cannot redirect output (when trying to redirect outputs to a file with ">")
  • rbash: xxxx: command not found (when trying to run commands not in the approved allow list)
  • rbash: ./example_script: restricted: cannot specify `/' in command names (when trying to run scripts)
  • Cannot initialize SFTP protocol. Is the host running an SFTP server? (when trying to setup file transfer tools like WinSCP)
  • Command 'cd "xxxx"' failed with return code 1 and error message. -rbash: line 47: cd: restricted (when trying to change directories with WinSCP)

Cause

rbash implementation means is that the shell behavior is changed by disabling some actions and features, including:

  • Changing directories with the cd builtin.
  • Setting or unsetting the values of the SHELL, PATH, ENV, or BASH_ENV variables.
  • Specifying command names containing slashes.
  • Specifying a filename containing a slash as an argument to the . builtin command.
  • Specifying a filename containing a slash as an argument to the -p option to the hash builtin command.
  • Importing function definitions from the shell environment at startup.
  • Parsing the value of SHELLOPTS from the shell environment at startup.
  • Redirecting output using the ‘>’, ‘>|’, ‘<>’, ‘>&’, ‘&>’, and ‘>>’ redirection operators.
  • Using the exec builtin to replace the shell with another command.
  • Adding or deleting builtin commands with the -f and -d options to the enable builtin.
  • Using the enable builtin command to enable disabled shell builtins.
  • Specifying the -p option to the command builtin.
  • Turning off restricted mode with ‘set +r’ or ‘set +o restricted’.

See here for more details:
https://www.gnu.org/software/bash/manual/html_node/The-Restricted-Shell.html 

Resolution

A few alternatives are presented here to make navigation and interaction with the system easier despite the limitations that are described above.

File Transfers 

Use SCP instead of SFTP or FTP protocol when setting up file transfer tools such as WinSCP.   
SLN321130_en_US__1icon Remember:
Users are not able to change directories (cd not allowed), so everything to be downloaded from the node or appliance has to be copied first to /home/service/user.
The only exception to this would be the normal Support Materials. Links are automatically placed in the home directory for each available set of Support Materials to facilitate downloads.

If you want to download files directly from the directory they are on, you have to find the full path first from the PowerStore shell, then you can use tools such as pscp (from windows cli) or scp (from linux).
Windows pscp example:

Syntax:
Usage: pscp [options] [user@]host:source target
pscp [options] source [source...] [user@]host:target
Note: in some new versions of Windows 10, you may have to specify the port (-P 22).

Download example:
pscp -scp -P 22 service@<appliance or node IP>:/path/to/file/to/download C:\Local\dowwnload-save\location

pscp -scp service@xx.xx.xx.xx:/cyc_var/cyc_service/data_collection/xxxxxxxx/powerstore_xxxxxxxx_2020-05-06_00-00-00_service-data.tgz C:\LOGS
service@xx.xx.xx.xx's password:
powerstore_xxxxxxxxx | 10944 kB | x.x kB/s | ETA: 00:00:00 | 100%

Upload example:
pscp -scp -P 22 C:\Logs\somefile.txt service@xx.xx.xx.xx:/home/service/user
service@xx.xx.xx.xx's password:
somefile.txt           | 211 kB | 212.0 kB/s | ETA: 00:00:00 | 100%

 

Navigation

You cannot use "cd" to navigate, but you can use commands like "ls" or "cat/less" to list directory contents or read files. The only difference is that you have to always use full paths.
The same principle applies to everything else (grep, and so on).

Example of listing the subdirectories within the Support Materials directory:
[SVC:service@xxxxxxx-B user]$ ls -l /cyc_var/cyc_service/data_collection/                                     
total 80
drwxrwsr-x+ 2 cyc cycg 4096 Apr  8 14:48 0941c91a-431d-4bfb-b5b2-062b02c45950
drwxrwsr-x+ 2 cyc cycg 4096 Apr 25 15:27 20439835-3654-4d93-af3b-ebfc0ae222fd
drwxrwsr-x+ 2 cyc cycg 4096 Apr 19 15:27 3d2011a8-0aa2-48d7-9f3f-1f234df2abfb
drwxrwsr-x+ 2 cyc cycg 4096 Apr 19 13:08 473ed1cb-0ebb-4bd6-bbf6-e87e61af8578
drwxrwsr-x+ 2 cyc cycg 4096 Apr 22 14:01 48a522ff-0aaa-4f83-a936-973f6f1097b2
drwxrwsr-x+ 2 cyc cycg 4096 Apr 22 15:26 4ba1375c-c23b-47c6-bc04-1498e3443b39
drwxrwsr-x+ 2 cyc cycg 4096 Apr 27 15:26 6faf6d88-58c6-4891-b001-8e0311e9e00d
drwxrwsr-x+ 2 cyc cycg 4096 Apr 24 14:36 798b13df-70bb-4fd3-9691-608b735207e9
drwxrwsr-x+ 2 cyc cycg 4096 Apr 28 15:27 8187fc5d-d389-4676-a69f-23db20c06602
drwxrwsr-x+ 2 cyc cycg 4096 Apr 26 15:12 83cb57dc-dee3-4dae-8585-e3b670d4b52a
drwxrwsr-x+ 2 cyc cycg 4096 Apr 18 12:50 a038d9ac-6ecc-4c49-8bb3-ae6623b418f6
drwxrwsr-x+ 2 cyc cycg 4096 Apr 21 13:43 b02e88fb-3f80-47a3-8f6d-3547afad7c35
drwxrwsr-x+ 2 cyc cycg 4096 Apr 24 15:26 b4bdd7c3-dbd0-4ac7-93ac-2e3e7ea1ff93
drwxrwsr-x+ 2 cyc cycg 4096 Apr 23 14:18 bf965b7e-e136-42ba-b46c-5fc565b6cf58
drwxrwsr-x+ 2 cyc cycg 4096 Apr 20 13:26 d96caca8-4395-4f15-aea1-60dd7a2490f5
drwxrwsr-x+ 2 cyc cycg 4096 Apr 23 15:26 e101bd57-fd3d-421a-b15a-341456a52f1f
drwxrwsr-x+ 2 cyc cycg 4096 Apr 25 14:54 e57e625d-e393-4919-b0d1-5efd89042897
drwxrwsr-x+ 2 cyc cycg 4096 Apr 20 15:26 ea40f70d-3cbf-4c84-9643-627fdbf9f0bd
drwxrwsr-x+ 2 cyc cycg 4096 Apr 21 15:26 ea9d95dd-1c72-4b2b-929a-ab6ec9cbedc1
drwxrwsr-x+ 2 cyc cycg 4096 Apr 17 12:34 fa02405b-ae24-4d7d-b178-97a99a2b717f
[SVC:service@xxxxxxx-B user]$ 

Article Properties


Affected Product

PowerStore, PowerStore 1000X, PowerStore 1000T, PowerStore Expansion Enclosure, PowerStore 3000X, PowerStore 3000T, PowerStore Rack, PowerStore 5000X, PowerStore 5000T, PowerStore 7000X, PowerStore 7000T, PowerStore 9000X, PowerStore 9000T

Last Published Date

27 Apr 2021

Version

8

Article Type

Solution