This commit is contained in:
@@ -1822,7 +1822,7 @@ func (a *App) syncNFSExportsFromOS() error {
|
||||
zfsPath = path
|
||||
}
|
||||
|
||||
cmd := exec.Command("sudo", "-n", zfsPath, "get", "-H", "-o", "value", "sharenfs", ds.Name)
|
||||
cmd := exec.Command(zfsPath, "get", "-H", "-o", "value", "sharenfs", ds.Name)
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
continue // Skip if can't get property
|
||||
@@ -1918,7 +1918,7 @@ func (a *App) syncNFSExportsFromOS() error {
|
||||
// syncSMBSharesFromOS syncs SMB shares from /etc/samba/smb.conf to the store
|
||||
func (a *App) syncSMBSharesFromOS() error {
|
||||
configPath := "/etc/samba/smb.conf"
|
||||
cmd := exec.Command("sudo", "-n", "cat", configPath)
|
||||
cmd := exec.Command("cat", configPath)
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
// If can't read smb.conf, that's okay - might not exist yet
|
||||
@@ -2054,8 +2054,8 @@ func (a *App) syncISCSITargetsFromOS() error {
|
||||
// Create the directories first if they don't exist
|
||||
os.MkdirAll("/tmp/.targetcli", 0755)
|
||||
os.MkdirAll("/tmp/targetcli-run", 0755)
|
||||
// Use sudo to run as root, then set environment variables in the command
|
||||
cmd := exec.Command("sh", "-c", "sudo -n sh -c 'TARGETCLI_HOME=/tmp/.targetcli TARGETCLI_LOCK_DIR=/tmp/targetcli-run targetcli /iscsi ls'")
|
||||
// Service runs as root, no need for sudo
|
||||
cmd := exec.Command("sh", "-c", "TARGETCLI_HOME=/tmp/.targetcli TARGETCLI_LOCK_DIR=/tmp/targetcli-run targetcli /iscsi ls")
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
// Log the error but don't fail - targetcli might not be configured
|
||||
@@ -2121,8 +2121,8 @@ func (a *App) syncISCSITargetsFromOS() error {
|
||||
// syncLUNsFromOS syncs LUNs for a specific target from targetcli
|
||||
func (a *App) syncLUNsFromOS(iqn, targetID string, targetType models.ISCSITargetType) error {
|
||||
// Get LUNs for this target
|
||||
// Use sudo to run as root, then set environment variables in the command
|
||||
cmd := exec.Command("sh", "-c", "sudo -n sh -c 'TARGETCLI_HOME=/tmp/.targetcli TARGETCLI_LOCK_DIR=/tmp/targetcli-run targetcli /iscsi/"+iqn+"/tpg1/luns ls'")
|
||||
// Service runs as root, no need for sudo
|
||||
cmd := exec.Command("sh", "-c", "TARGETCLI_HOME=/tmp/.targetcli TARGETCLI_LOCK_DIR=/tmp/targetcli-run targetcli /iscsi/"+iqn+"/tpg1/luns ls")
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
// No LUNs or can't read - that's okay, log for debugging
|
||||
|
||||
Reference in New Issue
Block a user