Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Bug: using as function with group fails on centos 5.11

Open
#315 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
bash, centos, ruby

Research direction

Start with the as(user: ..., group: ...) entry point and the generated sudo/sg command shown in the report. Reproduce the issue on CentOS 5.11 with execute :ls, then trace the quoting and escaping around the nested shell command. Done means the command parses successfully and runs ls as the specified user and group.

Written by the indexing model from the issue text.

Description

When trying to use the as function on centos 5.11 I consistent get this bash error

DEBUG [a0994eb0]    sh: -c: line 0: unexpected EOF while looking for matching `"'
DEBUG [a0994eb0]    sh: -c: line 1: syntax error: unexpected end of file

simple test

on roles(:whatever) do
   as(user: 'someuser', group: 'somegroup' ) do    
     execute :ls
   end
do

Command that is being ran

sudo -u someuser -- sh -c 'sg somegroup -c \"/usr/bin/env ls\"'

From what I can tell it's properly escaped. It works fine when only suppling the user and not a group.

Dominant language
Ruby
Stars
1.2k
Forks
257
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from capistrano/sshkit

All issues in capistrano/sshkit

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.