[SOLVED] sudo and XDG_CONFIG_HOME

I'm not really sure in which section my problem fits, but since I realized I had it creating a new package... Here it is.
I submitted a new package (brogue) to the AUR. The way the code was written makes it necessary to have the executable in the same folder as the png and so files. To work around it I thought of moving all the files to one folder and then create a shell script that would cd to that folder, run the game, and return to the previous path. I could move them to /usr/ or somewhere in $HOME. I chose the second one and here is my problem.
When I check for XDG_CONFIG_HOME in PKGBUILD I get one path and when I do it the same way to run the game I get another one.
if [ -z "$XDG_CONFIG_HOME" ]; then
    _config_dir="$pkgdir/$HOME/.config/brogue"
else
    _config_dir="$pkgdir/$XDG_CONFIG_HOME/brogue"
fi
if [ -z "$XDG_CONFIG_HOME" ]; then
  _config_dir="$HOME/.config/brogue"
else
  _config_dir="$XDG_CONFIG_HOME/brogue"
fi
I know this happens because (obviously) I install as root and run it as normal user. One way to solve this is to sudo -u username pacman but it is a crappy way.
What's wrong? Am I looking for XDG_CONFIG_HOME the wrong way in the PKGBUILD? Or should I have sudo using my user as default (don't really think so)?
PS: Since the files are not really config files, sould I dump them on other place? For instance, I realize that I could have solved this moving them to /usr/share/. But the problem would come eventually and I would have to ask you guys just the same....
Last edited by jlcordeiro (2010-10-14 13:36:58)

Packages should never touch the user's home directory in any way. Namcap could have warned you about this. You're also missing some dependencies.
Just install the executable and image files in /usr/share/brogue, the .so files in /usr/lib and add a frontend script to /usr/bin.
Note that this is still ugly. Installing the precompiled binaries and libraries should be avoided. Instead, create a separate package for libtcod and have your brogue package depend on it, then properly build brogue from source in your PKGBUILD.
In your frontend script, just cd to /usr/share/brogue and run it. No need to cd back to '-'.
Also, makepkg runs as a normal user, so using an environment variable in the PKGBUILD should yield the user value.

Similar Messages

  • [solved] sudo and yaourt problems after recent updates

    After recent updates (past week) yaourt started giving me problems. When using yaourt it prompts me for sudo password but it does not seem to use my sudo configuration.
    I get this:
    [sudo] password for root:
    [sudo] password for root:
    Password:
    su: Authentication failure
    Password:
    When entering mine or root's password I just get prompt again. The last password is for su, which when I enter root's works.
    It seems sudo is not using /etc/sudoers configuration either, as I have things like insults enabled and it used to work previously.
    Any reason for this?
    sudo works fine otherwise.
    Last edited by wrm (2014-03-29 23:12:26)

    Looks like this: https://github.com/archlinuxfr/yaourt/issues/5
    And this: https://bbs.archlinux.org/viewtopic.php?id=178776
    Last edited by 2ManyDogs (2014-03-24 21:33:40)

  • [SOLVED] sudo and "command not found" problems

    Ok, the problem I've got is this: sudo has suddenly started acting real strange. It can't find any programs. For example, if i type
    sudo echo
    It just goes
    sudo: echo: command not found
    And another problem I've got, is that as a regular user, it can't find programs in /sbin, or other "exotic" places. For example it can't find firefox, because it's not in /usr/bin or /bin, but in /opt/mozilla/bin.
    Please, help me!
    Last edited by mrpedroxx (2008-06-14 13:23:49)

    sudo -V outputs this
    Sudo version 1.6.9p15
    $PATH outputs
    bash: /usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.: No such file or directory
    pacman -Q firefox outputs
    firefox 2.0.0.7-1
    Yeah, maybe I should update it anyway
    And /var/log/errors.log does contain stuff about hard disks, but it's just me mounting my iPod and the Windows partition on my hd

  • [SOLVED] Sudo and seteuid issues

    A couple of days ago, something strange happened to my user account.  I  couldnt log into my window manager (enlightenment) as a non-root user.  Also, each time I would try to issue a command using sudo, it would return some error about seteuid (I can't rememer exactly what it said).  So I fiddled around with the sudoers file to make sure I had sudo access (which I now do), but I still can't issue the startx command as a non-root user or without sudo.  I suspect it has something to do with the seteuid error, but I don't know what to do about it.  If I run startx, it returns:
       Fatal server error: Cannot move old log file "/var/log/Xorg.0.log" to "/var/log/Xorg.0.log.old"
       xinit: givingup
       xinit: unable to connect to X server: Address family not supported by protocol
       xinit: server error
    I tried changing the permissions on these files, which didn't work.  Hours of google searching hasn't helped much, but here is a link to a page that describes a problem as similar to mine as I could find:  http://forum.tinycorelinux.net/index.php?topic=195.0
    It mentions this:
       BTW, the "Can't open /var/log/Xorg.o.log" is possibly because "set uid" became unset in the tcz conversion - does "ls -l /usr/local/bin/Xorg" show an "s" in there somewhere?"
    but I don't even have that file to try to use their solution.
    /home/user/.xinitrc contains only 1 line:  exec enlightenment_start
    Please help me figure what to do about the seteuid or setuid, so I can run startx as a non-root user, again.  Thanks!
    Last edited by cubisttriangle (2012-01-22 22:45:03)

    Awesome! Thank you, smudge! To fix:
    $ whereis Xorg
    Xorg: /usr/bin/Xorg /usr/share/man/man1/Xorg.1.gz
    $ ls -la /usr/bin/Xorg
    -rwxr-xr-x 1 root root 1.9M Dec 17 01:18 /usr/bin/Xorg
    $ sudo chmod +s usr/bin/Xorg
    -rwsr-sr-x 1 root root 1.9M Dec 17 01:18 /usr/bin/Xorg
    After these commands, I could get into my window manager again without root privileges.

  • [SOLVED] How to get sudo and kdesu to honor my user password?

    Hi folks,
    Well, I must be missing something. I think I've tried everything listed here https://bbs.archlinux.org/viewtopic.php?id=143487 and in the referenced links, but I still have the problem of my system rejecting my password for some uses of sudo and kdesu but not others.  I've included my /etc/sudoers file below.
    My problem may be due to screwing around with users:  I started out using bruce (1000), then switched to bbraley (1001), then deleted bruce in kusers, then changed bbraley to 1000. When that created more problems without solving the original one, I switched back to 1001.  I've played with adding and removing my user from groups, including creating a sudo group, making sure I am a member of wheel group, etc. 
    What seemed to be everyone's magic fix,
    pacman -S pambase
    didn't work when I tried it successfully with my bbraley password, then later, when that began failing, using the root password. pambase reinstalls, but there is no resulting change in the behavior of sudo.
    Side question: Most of my experience is with kubuntu in which I never created a root user and never had any trouble having my user password work with sudo or kdesu. Is there a reason Archwiki beginners guide suggests assigning a separate root account and password?
    Can anyone help?
    Here's the output of
    groups
    root adm disk wheel log locate network video audio optical storage scanner power users nm-openconnect systemd-network bbraley sudo sddm
    Here's the output of
    cat /etc/group |grep `id -un`
    root:x:0:bbraley
    adm:x:4:root,daemon,bbraley
    disk:x:6:root,bbraley
    wheel:x:10:root,bbraley
    log:x:19:root,bbraley
    locate:x:21:bbraley
    network:x:90:bbraley
    video:x:91:bbraley
    audio:x:92:bbraley
    optical:x:93:bbraley
    storage:x:95:bbraley
    scanner:x:96:bbraley
    power:x:98:bbraley
    users:x:100:bbraley
    systemd-network:x:193:bbraley
    nm-openconnect:x:104:bbraley
    sddm:x:619:bbraley
    bbraley:x:500:
    sudo:*:501:bbraley
    Here's what
    ls -l /etc/sudoer
    yields:
    -r--r----- 1 root root 2948 Mar 22 07:25 /etc/sudoers
    And here's my sudoers file:
    ## Defaults specification
    ## You may wish to keep some of the following environment variables
    ## when running commands via sudo.
    ## Locale settings
    # Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
    ## Run X applications through sudo; HOME is used to find the
    ## .Xauthority file. Note that other programs use HOME to find
    ## configuration files and this may lead to privilege escalation!
    # Defaults env_keep += "HOME"
    ## X11 resource path settings
    # Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
    ## Desktop path settings
    # Defaults env_keep += "QTDIR KDEDIR"
    ## Allow sudo-run commands to inherit the callers' ConsoleKit session
    # Defaults env_keep += "XDG_SESSION_COOKIE"
    ## Uncomment to enable special input methods. Care should be taken as
    ## this may allow users to subvert the command being run via sudo.
    # Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
    ## Uncomment to enable logging of a command's output, except for
    ## sudoreplay and reboot. Use sudoreplay to play back logged sessions.
    # Defaults log_output
    # Defaults!/usr/bin/sudoreplay !log_output
    # Defaults!/usr/local/bin/sudoreplay !log_output
    # Defaults!REBOOT !log_output
    ## Runas alias specification
    ## User privilege specification
    root ALL=(ALL) ALL
    ## Uncomment to allow members of group wheel to execute any command
    ##%wheel ALL=(ALL) ALL
    ## Same thing without a password
    %wheel ALL=(ALL) NOPASSWD: ALL
    ## Uncomment to allow members of group sudo to execute any command
    %sudo ALL=(ALL) ALL
    bbraley ALL=(ALL) ALL
    ## Uncomment to allow any user to run sudo if they know the password
    ## of the user they are running the command as (root by default).
    Defaults targetpw # Ask for the password of the target user
    ALL ALL=(ALL) ALL # WARNING: only use this together with 'Defaults targetpw'
    ## Read drop-in files from /etc/sudoers.d
    ## (the '#' here does not indicate a comment)
    #includedir /etc/sudoers.d
    Last edited by Bruce1956 (2015-03-28 05:16:03)

    Trilby wrote:I've never used the targetpw setting, but I wouldn't be surprised if that was the problem.  With that setting, if you want to run something as root (the default use of sudo) then you'd need the root password, not the user password.  Comment out that setting, and the next line.
    I had never used it, either, but I misread some reference and thought it might help. Since you say it causes the behaviour I'm trying to eliminate, I will get rid of it, as suggested. However, the behavior preceded my addition of this line in the file, so I don't think this will correct the problem. Edit: Removing it kept the root password from being universally required (I can now edit /etc/sudoers using my user password) and returned it to requiring it sometimes (I still need the root password to use kdesu).
    As for some other distro not having a root account, that is simply impossible.  There was a root account.  If you didn't have the password for it, then that installation was severely crippled.
    Sorry, you're right. I should have said that kubuntu does not expect users to assign a password to the root account and instead expects primary users to access that account's privileges via su, sudo, or kdesu only.
    https://help.ubuntu.com/community/RootSudo
    By default, the root account password is locked in Ubuntu. This means that you cannot login as root directly or use the su command to become the root user. However, since the root account physically exists it is still possible to run programs with root-level privileges. This is where sudo comes in - it allows authorized users (normally "Administrative" users; for further information please refer to AddUsersHowto) to run certain programs as root without having to know the root password.
    Thanks for responding to my request for help. Any other ideas?
    Edit:  Here's what I keep getting that only accepts the root password, not my user password
    http://s15.postimg.org/4z0o86oln/Runasroot_KDEsu.png
    -- mod edit: read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_Code [jwr] --
    Last edited by Bruce1956 (2015-03-23 04:41:06)

  • [SOLVED] Pacman and yaourt not working when run with "sudo"

    Hi,
    I am an Arch newbie, just installed Arch 3.10 on my machine. I access internet through a proxy server and I'm facing this strange problem -
    Pacman is unable to fetch packages when I run it through sudo - "sudo pacman -S smplayer" (It gives network unreachable error).
    However when I run it through root, it retrieves those same packages successfully.
    yaourt also faces a similar kind of problem -
    When I run it through sudo or as root, it is unable to retrieve packages which can be downloaded by pacman. But, when I run pacman to download those same packages, it is able to do so.
    I am using gnome 3.8, and use radiotray ( It's for listening online radios ). When I run it via 'Alt-F2' or as a startup application, it's not able to connect to any radio station ( which means it's not connecting to the internet ). However, on running it via terminal, it connects to the internet successfully. Are these 2 problems related ? I'm facing the first one even without loading gnome, so it's not gnome's problem, i guess.
    I can ping successfully through my administrator as well as root account, connect to the internet via browser, and ssh, git, bzr are also working fine.
    What can I do to resolve this ?
    Thanks
    Last edited by parinporecha (2013-09-12 06:01:06)

    parinporecha wrote:
    To configure proxy, I added the line "export http_proxy=PROXY_LINK" to the bashrc files of user and root.
    Regarding Arch 3.10, yes i meant the installation media from 2013.09.01 ( kernel 3.10 )
    That's why root works, but not sudo. Sudo clears the environment. See man sudo and man sudoers.

  • I want to install Photoshop but everytime I get an ERROR CODE: A12E1.How do I solve that and what is it?

    Hello,
    I want to install Photoshop but everytime I get an ERROR CODE: A12E1.How do I solve that and what is it?

    A12E1 error installing Creative Cloud products | CC
    Mylenium

  • After i download ios 5.1.1 i cant install it there is msg tell me an error occurred installing ios 5.1.1 what can i do to solve this and install the update ( i have ipad 2 ) ?????

    After i download ios 5.1.1 i cant install it there is msg tell me an error occurred installing ios 5.1.1 what can i do to solve this and install the update ( i have ipad 2 ) ?????

    No codes on the error just msg in the center of the ipad tell me that without any codes :@

  • TS3297 I can't empty the trash. I keep getting error code -8003, I have tried the terminal methods including both sudo and chflags. The apps that won't delete are

    I can't empty the trash I have three different versions of Quicken Essentials that should have been deleted and also some iskysoft apps [two ]. I tries to delete them but I always get a -8003 error. I ve tried using the terminal with both the sudo and chflags methods. No effect. Can anyone give a method that would work to delete the five? In advanced appreciation.

    Hey donnie90,
    It seems like this article might be the best for helping you address this issue:
    You can't empty the Trash or move a file to the Trash
    http://support.apple.com/kb/ht1526
    Thanks for coming to the Apple Support Communities!
    Regards,
    Braden

  • My iMail keeps crashing -- how do I solve this and do I need to re-install

    my iMail keeps crashing -- how to solve this and do I need to re-install

    Is it iMail or Mail ?

  • [Solved] Sudo: use admin password instead of user password?

    Sudo's default behavior is to ask you for your user password when you initiate a sudo command.
    How would you modify sudo so that it asks for the admin password instead?

    You would consult the excellent Arch wiki:
    http://wiki.archlinux.org/index.php/Sudo and http://wiki.archlinux.org/index.php/Su
    Please refrain from opening new threads when the answers have been provided for you and would be obvious with just the smallest effort on your own part.

  • [SOLVED] Sudo does not accept user password

    Hello , again !
    usually i run root commands with sudo , and i enter my current user password and everything works !
    Today , i updated my Arch linux with :
    pacman -Syu
    and my arch upgraded to 3.4.2-2. 
    but when i want to run a command with sudo , i cannot use my current user password ?
    thankyou
    Last edited by arashroshan (2012-06-19 11:10:52)

    thank you for reply but i have read sudo wiki and also sudo was working before updating .
    by the way su is still working .
    here is my sudoer file :
    ## sudoers file.
    ## This file MUST be edited with the 'visudo' command as root.
    ## Failure to use 'visudo' may result in syntax or file permission errors
    ## that prevent sudo from running.
    ## See the sudoers man page for the details on how to write a sudoers file.
    ## Host alias specification
    ## Groups of machines. These may include host names (optionally with wildcards),
    ## IP addresses, network numbers or netgroups.
    # Host_Alias    WEBSERVERS = www1, www2, www3
    ## User alias specification
    ## Groups of users.  These may consist of user names, uids, Unix groups,
    ## or netgroups.
    # User_Alias    ADMINS = millert, dowdy, mikef
    ## Cmnd alias specification
    ## Groups of commands.  Often used to group related commands together.
    # Cmnd_Alias    PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
    #                           /usr/bin/pkill, /usr/bin/top
    ## Defaults specification
    ## You may wish to keep some of the following environment variables
    ## when running commands via sudo.
    ## Locale settings
    # Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"                                                                                                                               
    ## Run X applications through sudo; HOME is used to find the                                                                                                                                   
    ## .Xauthority file.  Note that other programs use HOME to find                                                                                                                                 
    ## configuration files and this may lead to privilege escalation!                                                                                                                               
    # Defaults env_keep += "HOME"                                                                                                                                                                   
    ## X11 resource path settings
    # Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
    ## Desktop path settings
    # Defaults env_keep += "QTDIR KDEDIR"
    ## Allow sudo-run commands to inherit the callers' ConsoleKit session
    # Defaults env_keep += "XDG_SESSION_COOKIE"
    ## Uncomment to enable special input methods.  Care should be taken as
    ## this may allow users to subvert the command being run via sudo.
    # Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
    ## Uncomment to enable logging of a command's output, except for
    ## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.
    # Defaults log_output
    # Defaults!/usr/bin/sudoreplay !log_output
    # Defaults!/usr/local/bin/sudoreplay !log_output
    # Defaults!/sbin/reboot !log_output
    ## Runas alias specification
    ## User privilege specification
    root ALL=(ALL) ALL
    ## Uncomment to allow members of group wheel to execute any command
    %wheel ALL=(ALL) ALL
    ## Same thing without a password
    # %wheel ALL=(ALL) NOPASSWD: ALL
    #arashr ALL=(ALL) All
    ## Uncomment to allow members of group sudo to execute any command
    # %sudo ALL=(ALL) ALL
    ## Uncomment to allow any user to run sudo if they know the password
    ## of the user they are running the command as (root by default).
    # Defaults targetpw  # Ask for the password of the target user
    # ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'
    ## Read drop-in files from /etc/sudoers.d
    ## (the '#' here does not indicate a comment)
    #includedir /etc/sudoers.d
    Last edited by arashroshan (2012-06-17 10:02:55)

  • My iphone  screen has gone white with a few grey lines down the right hand side.. Has anyone any ideas how I can solve this and get my screen back to normal..? Thanks

    my iphone screen has gone white with a few grey lines down the right hand side.. Has anyone any idea how I can solve this and get my screen back to normal..? Thanks

    Hi tag71,
    If you are having issues with the display on your iPhone, you may find the Display portion of the following article helpful:
    iPhone: Hardware troubleshooting
    http://support.apple.com/kb/ts2802
    Regards,
    - Brenden

  • I would like to get data analysis for solving statistic and making graphs, but this function is not in add-in. How should I do? I also set up microsoft office for mac 2011.

    I would like to get data analysis for solving statistic and making graphs, but this function is not in add-in. How should I do? I also set up microsoft office for mac 2011.

    Microsoft didn't include that with the 2011 version.
    There is a third-party application that substitutes for the add-in: http://www.analystsoft.com/en/products/statplusmac/
    They also have a limited, free version.

  • Fingerprint sudo and su authentication on Thinkpad E430

    I have followed the tutorial on the Arch Wiki (https://wiki.archlinux.org/index.php/Fingerprint-gui) to enable fingerprint authentication using the fingerprint-gui, changing the files /etc/pam.d/sudo and /etc/pam.d/su as described.
    su is working fine with fingerprint, however when I try to use sudo, first it prompts for a password, like this:
    "Password:"
    Then if you type anything, it asks for the real password:
    "[sudo] password for eric:"
    I can't understand why su works fine and sudo does not. My files look like this:
    /etc/pam.d/su
    #%PAM-1.0
    auth            sufficient      pam_rootok.so
    auth            sufficient      pam_fingerprint-gui.so
    # Uncomment the following line to implicitly trust users in the "wheel" group.
    #auth           sufficient      pam_wheel.so trust use_uid
    # Uncomment the following line to require a user to be in the "wheel" group.
    #auth           required        pam_wheel.so use_uid
    auth            required        pam_unix.so
    account         required        pam_unix.so
    session         required        pam_unix.so
    /etc/pam.d/sudo
    #%PAM-1.0
    auth            sufficient      pam_fingerprint-gui.so
    auth            required        pam_unix.so
    auth            required        pam_nologin.so
    Any idea of what could be going on?

    I am not sure about how it acts with the new versions of sudo.  But I wrote that page.  The information I pulled from is here:
    http://www.n-view.net/Appliance/fingerp … anual.html
    I did get it working on my machine,  But I noticed that when I would use sudo, it would ask me for a password while simutaneously asking for a swipe.  If I chose to use my keyboard, it would kill the fingerprint dialog box, and then ask for my sudo password again.  Is this what you are saying that it is doing? 
    I didn't find a workaround for that because, honestly, I found the fingerprint reader really annoying to use.  I guess just having to take my hands off the keyboard to do that just seemed to me like a hassle.  I think one spot where it would be pretty good though is for your login manager.  Unfortunately, I don't use one of those either....
    I think the reason why I put the work into figuring out how to get it to work is because I wanted to see if I could get all the stuff working on my machine.  I guess you have probably found my E430 page as well, and I did indeed finally get everything working.
    BTW, what kind of wifi card did your machine come with?  Does it use the rtl8192ce module?  If so, good luck!  (I can help you with that if you need)

Maybe you are looking for