Browsing articles tagged with "su - Admins Goodies"
Feb 8, 2013
tom

Save file after forgetting to open as root / sudo vi [duplicate]

Possible Duplicate: vim re-edit as root I could have sworn I saw this question asked. But after looking though every search result for “vi” I’m stumped/lazy. I’ve opened a file, made an edit and now I realize it’s read only and I’ve opened it as non-root me. Asked by MathewC I think you want something like this: :w !sudo tee “%” I first saw it on commandlinefu. The quotes are only necessary if the file [...]

Continue Reading »
Dec 20, 2012
tom

How to grant su access without password to one user only in wheel group (FreeBSD)?

I know how to enable su without a password for all wheel group users by adding the appropriate configuration line in /etc/pam.d/su. I do not want to enable this for all wheel users but only one particular user. I am using FreeBSD 8.1. How do I do this? UPDATE in response to comments below This is a pfSense box. Underlying OS is FreeBSD 8.1 but as usual for pfSense a lot of functionality is missing, [...]

Continue Reading »
Jun 11, 2012
tom

centos: su silently fails

On a CentOS server where I’m logged via SSH as root, I do: su otherusername where ‘otherusername’ is the user name of another user, which exists. It does nothing. After that, I’m still root. whoami returns root, any file I create belongs to root, that is, su just doesn’t su. However it does not give any error message. If I try to su with an invalid user name it does give an error message. What [...]

Continue Reading »
May 10, 2012
tom

BASH Scripting, su to www-data for single command

I am working on automating the creation of subversion repositories and associated websites as described in this blog post I wrote. I am running into issues right around the part where I su to the www-data user to run the following command: svnadmin create /svn/repository There is a check at the beginning of the script that makes sure it is running as root or sudo, and everything after that one command needs to be run [...]

Continue Reading »
Mar 24, 2012
tom

How to grant su access to wheel without asking for password on FreeBSD?

I would like to grant users of the wheel group (other sysadmins) su access without being asked for password. I know how to do it with pam in linux, but the question now is for FreeBSD. I am not familiar with the syntax for FreeBSD’s PAM subsystem. What shall I enter in /etc/pam.d/su instead of the default: auth sufficient pam_rootok.so no_warn auth sufficient pam_self.so no_warn auth requisite pam_group.so no_warn group=wheel root_only fail_safe ruser auth include [...]

Continue Reading »
Feb 5, 2012
tom

How should I use sudo from an upstart script?

I am using upstart to run my node.js app on an Amazon Linux AMI EC2 instance. I have had a few issues getting it to work, summarized below. In my script I had a line like this: exec sudo -u www /usr/local/bin/node /var/www/foo/app.js >> /var/log/foo.sys.log 2>&1 When run, the job never got passed stop/waiting, and when I turned on log-priority debug I saw this line: sudo: sorry, you must have a tty to run sudo [...]

Continue Reading »
Nov 21, 2011
tom

Executing a command as a nologin user

I’ve recently set up my server so that my suPHP ‘virtual’ users can’t be logged into by using this article My issue now is that before when I ran a rake command for my Ruby on Rails application running on the server, I used su to go into www-data and execute the command from there – obviously I can’t do that anymore because of the nologin. So as a root user, how can I execute [...]

Continue Reading »
Nov 6, 2011
tom

/bin/su permission denied after SELinux is enabled – not resolved by manual creation of SELinux policies

For some reason, I can’t su to root with from a non-root user: [rilindo@kerberos ~]$ /bin/su – -bash: /bin/su: Permission denied Running output from /var/log/audit/audit.log either returns this: [root@kerberos tmp]# cat /tmp/audit type=AVC msg=audit(1319322088.937:68012): avc: denied { execute } for pid=9794 comm=”bash” name=”su” dev=dm-0 ino=1048659 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:su_exec_t:s0 tclass=file type=SYSCALL msg=audit(1319322088.937:68012): arch=c000003e syscall=59 success=no exit=-13 a0=26a7df0 a1=26c9b30 a2=269efa0 a3=18 items=0 ppid=8435 pid=9794 auid=500 uid=500 gid=500 euid=500 suid=500 fsuid=500 egid=500 sgid=500 fsgid=500 tty=pts0 ses=4454 comm=”bash” exe=”/bin/bash” subj=user_u:user_r:user_t:s0 [...]

Continue Reading »
Nov 2, 2011
tom

How to su to another user in mac OS X?

I came from Linux world , and not familiar with OS X admin. Now I want to su to another user , but it just not working … Where goes wrong here ? smallufo@miniserver:~ $ whoami smallufo smallufo@miniserver:~ $ su – postgres Password: smallufo@miniserver:~ $ whoami smallufo smallufo@miniserver:~ $ I input correct password , but why I cannot su to postgres ? Sorry if it is a dumb question , but I’ve been stuck with [...]

Continue Reading »
Sep 28, 2011
tom

How to access an account with the su-command?

Problem: to access an account in MacOS with the su-command, more here. I can access my other accounts, but not the one created according to the intructions. The command does not change the user: su postgres Question: Why can I not access an account with the su-command? Do you get any sort of error? It could be that the account has an invalid shell (like /usr/bin/false) in which case it would switch to that user [...]

Continue Reading »
Pages:123»