Is there any way to read files from the virtual /proc directory using smbclient?

No root access. Both server and client are Debian Linux machines. Server is running Samba 3. Smbclient version is 4.0.6-Debian

Copying files from servers /proc filesystem with get /proc/cpuinfo in smbclient's interactive mode result in an empty file being copied.

1 Answer 1


You cannot copy the file because smbclient / smbget do not check size of file after it is opened. It has nothing to do with permissions.

You should check how is it done in dolphin (kde file manager) because it CAN copy remote files from proc even if they report zero size). You can obtain source code via git clone git://anongit.kde.org/kde-baseapps but I'm not sure if smb handling is included there.

I don't know what you want to do but maybe you could write simple script on the server that will copy /proc/cpuinfo content to a 'normal' file and get this file via smb.

If you just want to obtain content of /proc file on another computer and it can be something else (not samba) you can try to use for example cgi scripts.

Sample script that I once wrote that shows current CPU usage:


echo Content-type: text/plain


CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
unset CPU[0]                          # Discard the "cpu" prefix.
PREV_IDLE=${CPU[4]}                        # Get the idle CPU time.
PREV_TOTAL=(`cat /proc/stat | grep '^cpu ' | awk '{ sum = $2 + $3 + $4 } END { print sum }'`)

# Calculate the CPU usage since we last checked.
sleep 1

CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
unset CPU[0]                          # Discard the "cpu" prefix.
IDLE=${CPU[4]}                        # Get the idle CPU time.
TOTAL=(`cat /proc/stat | grep '^cpu ' | awk '{ sum = $2 + $3 + $4 } END { print sum }'`)


echo -en "\rCPU:$DIFF_USAGE%\nTOTAL:$DIFF_TOTAL\nIDLE:$DIFF_IDLE                  "
# Remember the total and idle CPU times for the next check.

Output on web page:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .