I'm writing a program that checks who the user is, if it's the correct user logged in it will upload data to my FTP server. It encrypts the data using tar, than openssl. I think that part is correct however when passing system commands to the terminal I'm having an issue with strcpy. I keep getting an error that "there are to many arguments to function strcpy. Specifically where it says "strcpy(encrypt, "tar -cf /home/%s", p);" I think it's because I'm passing the variable p to it. Could anyone assist. Thank you.
int main(int argc, char *argv[])
{
// checks to see who the user is
char *p=getenv("USER");
if (p=NULL) return EXIT_FAILURE;
printf("User is %s\n", p);
char *usr;
char *encrypt;
char *upload;
//encrypts folder using tar, then openssl AES 256 bit
strcpy(encrypt, "tar -cf /home/%s", p);
system(encrypt);
strcpy(encrypt, "openssl enc -aes-256-cbc -in FILE.NAME -out file.enc");
system(encrypt);
// uploads data to ftp server using curl
strcpy(upload, "curl -T /PATH/ SERVER_ADDRESS");
system(upload);
return 0;
}