In the following terms that may cause confusion are explained.
A "user" is a term that everyone understands intuitively. However, the understandings may differ which can cause confusion.
The term is used differently in
This chapter aims at explaining the differences and giving a rationale for why Erlang/OTP handles "user" as it does.
Many have been in contact with the command 'ssh' on a Linux machine (or similar) to remotly log in on another machine. One types
ssh host
to log in on the machine named
You could log in as the user
ssh anotheruser@host
and you will then be enabled to act as
So what does "your user name has rights" mean? In a UNIX/Linux/etc context it is exactly as that context:
The user could read, write and execute programs according to the OS rules.
In addition, the user has a home directory (
When SSH tries to log in to a host, the ssh protocol communicates the user name (as a string) and a password. The remote ssh server checks that there is such a user defined and that the provided password is acceptable.
If so, the user is authorized.
This is a stronger method where the ssh protocol brings the user name, the user's public key and some cryptographic information which we could ignore here.
The ssh server on the remote host checks:
if so, the user is authorized.
After a succesful incoming authentication, a new process runs as the just authenticated user.
Next step is to start a service according to the ssh request. In case of a request of a shell, a new one is started which handles the OS-commands that arrives from the client (that's "you").
In case of a sftp request, an sftp server is started in with the user's rights. So it could read, write or delete files if allowed for that user.
For the Erlang/OTP SSH server the situation is different. The server executes in an Erlang process in the Erlang emulator which in turn executes in an OS process. The emulator does not try to change its user when authenticated over the SSH protocol. So the remote user name is only for authentication purposes in the Erlang/OTP SSH application.
The Erlang/OTP SSH server checks the user name and password in the following order:
The user name, public key and cryptographic data (a signature) that is sent by the client, are used as follows (some steps left out for clearity):
After a successful authentication an Erlang process is handling the service request from the remote ssh client. The rights of that process are those of the user of the OS process running the Erlang emulator.
If a shell service request arrives to the server, an Erlang shell is opened in the server's emulator. The rights in that shell is independent of the just authenticated user.
In case of an sftp request, an sftp server is started with the rights of the user of the Erlang emulator's OS process. So with sftp the authenticated user does not influence the rights.
So after an authentication, the user name is not used anymore and has no influence.