Running RStudio Server as non-root

Hello All,

I am trying to run RStudio Server as non-root user in a docker container and received following error [ERROR].
This works fine with default user rstudio-server. Am I missing any thing here?

--Snippet
RUN rm -f /var/lib/rstudio-server/secure-cookie-key

Start Service

ENTRYPOINT ["/usr/lib/rstudio-server/bin/rserver"]
#CMD ["--server-daemonize=0", "--server-app-armor-enabled=0"]
CMD ["--www-port=8888", "--auth-none=1", "--server-daemonize=0", "--server-app-armor-enabled=0", "--server-user=rstudio", "--server-data-dir=/var/run/rstudio-server"]

--

ERROR:

2023-03-10T06:14:05.621212Z [rserver] ERROR system error 2 (No such file or directory) [description: User not found., user-value: ]; OCCURRED AT rstudio::core::Error rstudio::core::system::User::Impl::populateUser(rstudio::core::system::User::Impl::GetPasswdFunc&, T) [with T = const char* rstudio::core::system::User::Impl::GetPasswdFunc = std::function<int(const char*, passwd*, char*, long unsigned int, passwd**)>] src/cpp/shared_core/system/User.cpp:68; LOGGED FROM: static rstudio_boost::shared_ptrrstudio::server::auth::handler::UserSession rstudio::server::auth::handler::UserSession::lookupUserSession(const string&) src/cpp/server/auth/ServerAuthHandler.cpp:943

Many thanks.

Regards,
Amar.

Hello @Theo :wave:

Do you have a line in your dockerfile where you add the user? Something like:
RUN useradd rstudio

Hi EliMiller,

Thanks for your reply.

Please find the useradd commands from Dockerfile.

ARG USERNAME=rstudio
ARG USER_UID=1000
ARG USER_GID=1000

RUN groupadd --gid $USER_GID $USERNAME
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
&& echo $USERNAME ALL=(root) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME
&& chmod 0440 /etc/sudoers.d/$USERNAME
&& echo "$USERNAME:$USERNAME" | sudo chpasswd

Regards.

Taking a look at the workbench documentation here. You also want the --system flag in useradd when using an alternate user.

Tried you suggestion, but no luck.

Is the rserver should always be started as root user or by sudo?

Thanks.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.