A user in a restricted bash shell should be able to successfully run the passwd
command as long as they have the location(full path of containing directory) of a working passwd
binary in their search path.
That is the usual with rbash
as the restrictions by default apply only to:
• changing directories with cd
• setting or unsetting the values of SHELL, PATH, ENV, or
BASH_ENV
• specifying command names containing /
• specifying a filename containing a / 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 command to replace the shell with
another command
• adding or deleting builtin commands with the -f and
-d options to the enable
builtin command
• using the enable builtin command to enable disabled shell
builtins
• specifying the -p option to the command builtin command
• turning off restricted mode with set +r or set +o
restricted.
If,however, you are adding some extra strict measures other than using rbash
as the user's shell, you might want to look at what passwd
actually needs to access, open, or write to with strace
like so:
strace -e open,openat,write,access passwd