Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
How to execute a command on behalf of a user if login is denied

I need to run tomcat on behalf of tomcat user. But in /etc/passwd I have the following line:

tomcat:x:505:506::/usr/share/tomcat:/bin/nologin

So when I try to do this: sudo su tomcat ./bin/startup.sh

It complains about: su: /bin/nologin: No such file or directory

How do I execute the command with proper permissions?

Thanks in advance!

P.S. I'm trying to reverse engineer the configuration and it's production. So I have to be delicate...

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Try running:

sudo -u tomcat ./bin/startup.sh

By avoiding su you avoid trying to invoke the user's login shell.

over 4 years ago · Santiago Trujillo Relatório

0

You can specify shell with -s option

sudo su -s /bin/bash -c ./bin/startup.sh tomcat
over 4 years ago · Santiago Trujillo Relatório

0

actually, the best way to do this is via runuser

the man page is here http://man7.org/linux/man-pages/man1/runuser.1.html

this tool is used to deal with the situation as the developer said in his bolg

Whenever an service is running as root and wants to change UID using the shell it should use runuser.

http://danwalsh.livejournal.com/55588.html

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda